Friday, April 3, 2015

Get All Users from a SharePoint Site

Every now &  then you run into a request where someone wants to know who all has access to a specific SharePoint site. All those who have fancy tools to work with don't have to worry about this, however some poor souls like me have to depend on PowerShell.

You can invoke the script by doing something like this.

$Users = Get-UsersInWeb -Url http://portal.contoso.com/sites/somesite

Once you have populated the variable $Users, you should be able to easily export it to CSV using a statement like the one below:


$Users | ConvertTo-Csv -NoTypeInformation | Out-File c:\users.csv

Monday, January 26, 2015

Extract Farm Solutions from SharePoint Server

Recently I was setting up a replica of an existing production farm for QA & Dev purposes and I again got myself into a situation where people didn't know which was  the correct version of the code deployed to the farm.  The one pulled from the source control and the one running on the production farm were obviously yards & miles away. While how to do release management is not the part of this post, I wanted to highlight a neat trick that administrators and developers can use to get a copy of solution packages straight from the farm.

The following snippet will help you do just that.

Thursday, January 15, 2015

Debug Messages, Stack Trace & the Notorious web.config

The number of times one must enable debugging in web.config is really high and one thing to remember always is that enabling debugging only in the web application's web.config isn't of a lot of help at all times. So always check the following and enable debugging in these places too.

  1. \14\TEMPLATE\LAYOUTS\web.config
  2. \14\TEMPLATE\ADMIN\web.config
  3. Finally the web.config of your web application
Always perform the following on all the config files.
  • customErrors mode="Off"
  • CallStack="true"
  • compilation batch="true" debug="true" optimizeCompilations="true"

And BTW, there's nothing new in here. I just need a place where I can find this every single time I need it.

Monday, November 17, 2014

Install multiple language packs in one go

Have you ever been in a situation where you've to install a dozen different language packs for your servers? Then you know what I'm talking about. On one hand each pack takes about 15 - 30 minutes to install and having to wait for one to complete so that you can start off the next one felt like a criminal waste of  time. So I decided to get some help from PowerShell to make this part a bit easier.

I was installing a dozen language packs and  this saved some frustration for me.
And don't forget to run PSCONFIG after you're done installing. If you were to run it on a command line, this is what I'd do: 

PSConfig -cmd upgrade -inplace b2b -cmd applicationcontent -install -cmd installfeatures

Monday, August 26, 2013

Trouble downloading large Adobe PDF files from a SharePoint 2013 anonymous site

I'm working on a .COM site that's built on top of SharePoint 2013 and a few hours before we were about to go live, an interesting issue was reported by the test group. Some PDF files weren't being served properly and the request for the PDF would end up in a no man's land. We narrowed down the issue to PDF files that are larger than 5 - 6 MB and wasn't sure of what was causing this in the first place. Fiddler traces revealed that a HTTP 504 was occurred every time there's a failure. After looking around I ended up on the following KB by Microsoft:

You cannot open some IIS 7.5-hosted PDF documents by using a Web browser that has the Adobe PDF Reader plug-in enabled


I thought I've found the cause and downloaded the hot fix right away and then came the next surprise. For some reason not known to me yet, the fix wouldn't install on my server. Then more research revealed that I could do a URL Rewrite on IIS to overcome the issue as stated in the article IIS 7.5 Not Serving PDF Files In IE. However,  I wasn't very comfortable doing this and that's when it hit me real hard.

What about the blob cache? Could that be causing this issue? So I reconfigured the blob cache on my farm to not cache PDF files and and voila everything started working just fine.


Even though things started working, I wasn't convinced of the fix, because what's the point of using blob cache if we cannot cache PDFs in there? So I went around digging further and read through the SharePoint Server Caches Overview published by Microsoft and I don't see even one mention of such an issue. It looks like this document was published during the SharePoint 2010 days; so I went looking for the latest version that applies to SharePoint 2013 and landed up at Plan for caching and performance in SharePoint Server 2013. But to my surprise, I didn't find anything over there as well. For now, I'm closing this post here, but will continue researching on this and will update this post if I ever manage to find something new. In the meanwhile, if any of you have found any information pertaining to this issue, please point me in the direction.

Sunday, October 28, 2012

My 24 Hours with Microsoft Surface

When Microsoft announced the preorder for the Surface, I couldn't resist it. I went ahead and ordered the Surface RT 64 Gig one. The device has a real beautiful display and the add on keyboard is wonderful. I should say that this tablet has the best support for typing hands down (I own my fair share of tablets of different kinds).

IE looks gorgeous along with Word, PowerPoint, Excel and OneNote. The multitasking is pretty cool and so are the gestures for doing various other things. Here is a screenshot of Netflix & Facebook side by side on the Surface.



And I just love the Live Tiles (Wish Apple had something this cool).



IMHO, it would have been much more better if Microsoft had worked closely with more people on the apps side and come up with a much tighter social integration etc. But I should say that the device has a good potential in terms of hardware and when more apps get added to the store, this one should be able to offer some serious competition to the iPad and another Android based tablets.

Until this moment, not a single app has crashed on me nor has Windows itself and that is giving me a good feeling. I hope Microsoft will do its best to keep this market competitive and active.

Now it is time for me to fire up my Visual Studio to see what I can do to get something quick & dirty on the Surface. I'll keep you folks posted on what I come up with ASAP. (I am still unpacking boxes from my move to a new place over the weekend). And guess what? I wrote this whole Post on the Surface using IE.

There is something that made me feel unhappy. Silverlight doesn't run on this one. Should I say Yet? I'm quite unsure of that St this point.


Don't know how to make a screenshot on your Surface? Just hold the Windows Key down and while doing so, press and hold the Volume down key for a second and your screen shot will be saved to a folder under Pictured.

Tuesday, October 23, 2012

SharePoint 2013 - WCM - Incorporating Videos into Pages

A while ago I was working on a project for a client who needed to incorporate quite a few videos into their SharePoint portal. Needless to say the process wasn't easy or friendly. But with the advent of SharePoint 2013 this pain is going to go away!