Wednesday, August 21, 2013

Windows PowerShell Script to get Site Collections Quota in a Farm


We have a requirement to get the list of all the Site collections along with their Site quotas.
Below Windows PowerShell script will output the following information,
 
  • Site URL
  • Assigned/Allocated Site Quota Size
  • Total Storage User
You can copy the below script into a notepad and edit the OutputFile and Siteurl as needed in your environment save the file as Script.PS1. You can also paste the code in the SharePoint 2010 Management Shell. (Keep in mind to run as Administrator)
 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#Configure the location for the SiteCollectionQuota output file
$OutputFile="C:\SiteCollectionsQuota.csv";
"Site URL"+","+"Quota Limit (MB)"+","+"Total Storage Used (MB)"+"" | Out-File -Encoding Default -FilePath $OutputFile;
#Specify the root site collection within the Web app
$Siteurl="Your web application URL";
$Rootweb=New-Object Microsoft.Sharepoint.Spsite($Siteurl);
$Webapp=$Rootweb.Webapplication;
#Loops through each site collection within the Web app
Foreach ($Site in $Webapp.Sites)
{if ($Site.Quota.Storagemaximumlevel -gt 0) {[int]$MaxStorage=$Site.Quota.StorageMaximumLevel /1MB} else {$MaxStorage="0"};
if ($Site.Usage.Storage -gt 0) {[int]$StorageUsed=$Site.Usage.Storage /1MB};
if ($Storageused-gt 0 -and $Maxstorage-gt 0){[int]$SiteQuotaUsed=$Storageused/$Maxstorage* 100} else {$SiteQuotaUsed="0"};
$Web=$Site.Rootweb; $Site.Url + "," +$MaxStorage+","+$StorageUsed | Out-File -Encoding Default -Append -FilePath $OutputFile;$Site.Dispose()};

 Reference: SharePoint Server 2010 Windows PowerShell cmdlets, http://technet.microsoft.com/en-us/library/ff678226(v=office.14).aspx

Thursday, August 15, 2013

Get SharePoint List Name from GUID


We have couple of errors recorded in ULS logs with List Id\GUID and we need to get the list name to troubleshoot further.

 Here is the code snippet to get SharePoint list Name from GUID.
 
SPSite Site= new SPSite("Your Site Name");
SPWeb Web= Site.OpenWeb();
Guid id = new Guid("Your LIST GUID");
SPList list = Web.Lists.GetList(id, true);
 
Hope this helps

Friday, July 26, 2013

SharePoint Server 2010 SP2

SharePoint Server 2010 SP2 is released and here is the link, http://www.microsoft.com/en-us/download/details.aspx?id=39672

As per Microsoft here are the list of issues that are fixed,

  • Navigating to a SharePoint site with a BlackBerry device may open a non-mobile page. Adding RIM6 into compat.browser allows users to access SharePoint pages and view documents in mobile view.

  • If anonymous access is enabled for SharePoint 2010 SP1 (or later Cumulative Update), attempts to t access the site via a mobile device will receive an authentication prompt.

  • Customers are unable to use spell check in Korean when running SharePoint on Windows Server 2012.

  • Displaying Summary Links Web Part in personalizing view; generating confusing error message.

  • Deployment fails for content types containing a formula field in Italian.

  • File attachments are not deleted due to incorrect URL formatting

  • If requireExactUrl is not set for openweb calls, the PublishingWeb constructor may spawn variation pages  into incorrect locations while attempting re-creation of failed label during create hierarchies.

  • Incremental content deployment fails, giving the following error: FatalError: The given key was not present in the dictionary

  • Spell Checker doesn't work properly with Internet Explorer 10.

  • Rich text editor spell checker may work incorrectly on 64 bit machines.

  • Customers encounter issues sending e-mail from workflows when the From address uses a non-Unicode character set.

  • Updated VBE7.dll to fix safe array corruption for x64 hosts when calling UDF methods using safe array arguments directly from the host.

  • SQL exceptions will appear in the log when running update statistics timer.

  • Improved performance of the AllUserData table.

  • Getting a feed against a discussion board fails if feed contains more than zero items.

  • SharePoint 2010 client object model now has compatibility for accessing SharePoint 2013 servers.

  • Windows 8 users with Internet Explorer 10 receive an error when trying to open a document from SharePoint 2010 directly in the Office client.

  • Call GetChanges won’t return changes in certain cases where the change log has been edited and no parameters are set.

  • STSAdm MigrateUser fails when SQL server is not in domain.

  • Attempting to delete a child web from site settings causes the page to fail.

  • There is no exposed method to recalculate the second stage recycle bin size.

  • April 2011 Calendar View does not display correctly with Amman System Time zone

  • Users can create a scenario where a site loses permissions.

  • After deleting a web that contains historical document versions in the RecycleBin, rows are abandoned in the database.  These rows bloat the size of the database, causing difficulty with database management operations such as backup/restore, complicating upgrade and other scenarios.

  • After creating alerts on a document library with unique permissions and moving the contents using SPFolder.MoveTo method, the permissions seem to be lost and even the farm administrator is not able to delete these alerts.
 

Thursday, January 3, 2013

SharePoint error when editing a wiki page “Sys.WebForms.PageRequestManagerServerException: An unexpected error has occurred”

Some of the users in my organization noticed  SharePoint error when editing a wiki page: “Sys.WebForms.PageRequestManagerServerException: An unexpected error has occurred”


 
Looked at the ULS logs and found some access denied errors which tells me that there is some security issue. Started to review the  site permissions and noticed all Out Of Box SharePoint Groups were deleted and I released something is wrong with  “Style Resources Reader” SharePoint Group and  added this group manually to the site with Read permissions and this didn’t help.

I found a couple of Blog posts suggesting to grant read  access to Style Resources Reader” SharePoint Group to the Master Page Gallery and the Style Library. Go to Site Actions à Site Settings à Site Administration and click on Content and Structure à  Master Page Gallery àEdit Properties and grant read  access to Style Resources Reader” SharePoint Group, repeat the same to the Style Library as well.

Lessons learnt is not to delete the OOB SharePoint groups