Quickly find the current used storage of your site collection by using REST

By Namwar Rizvi - Last updated: Wednesday, November 19, 2014

If you want to find out how much storage your SharePoint site collection is currently using then you can use the following REST url in your browser

://<Replace your Site Collection Url>/_api/site/Usage/Storage

For example:

http://sp/_api/site/Usage/Storage

You will get response similar to following. Please note SharePoint report storage in bytes so to get the size in MB you need to divide it by 1048576 .

In following example: storage in MB will be 8038715 / 1048576 = 7.67 MB

 

Storage Size by REST

 

 

Share
Filed in Architecture, Configuration, REST, Solutions, Tips, Troubleshooting • Tags: , , ,

All possible ways to find SharePoint Version and Build number

By Namwar Rizvi - Last updated: Monday, November 3, 2014

If you are trying to find exact Version and Patch level of your SharePoint installation, then use one of the following methods

Method 1 : Using Service.cnf url

  1. Navigate to following url in your browser  <Your SharePoint Site>/_vti_pvt/Service.cnf
  2. You will a response similar to following

vti_encoding:SR|utf8-nl
vti_extenderversion:SR|14.0.0.4762 

Check the number shown in your response at SharePoint Build Numbers

Method 2 : Using Central Administration Site

  1. Launch SharePoint Central Administration site
  2. Under Upgrade and Migration, click Check product and migration status
  3. You will get screen similar to following

Farm Build and Version Number

Method 3 : Using PowerShell

  1. Launch SharePoint 2010 Management Shell
  2. Enter PowerShell command Get-SPFarm | Select BuildVersion
  3. You will get screen similar to following

PowerShellSPFarmBuildNumber

Method 4 : Checking Registry setting

  1. Launch Registry Editor on your SharePoint web front end
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0
  3. Check the value of BuildVersion as shown in following screen

RegistryVersion

Method 5 : Checking HTTP Header

  1. Launch Fiddler or any other Proxy traffic inspector on any client computer which can access a SharePoint site
  2. Navigate to any page of your SharePoint site on client computer
  3. Check MicrosoftSharePointTeamServices response header in Fiddler, as shown in screen below

Http Header Version

Share
Filed in How To, Installation, PowerShell, Service Pack, SharePoint 2013, SP2010, Tips, Troubleshooting • Tags: , , , , , , , , , , , ,

Solution for “SharePoint Designer cannot display the item” error to edit workflow

By Namwar Rizvi - Last updated: Sunday, November 2, 2014

If you are unable to edit workflows in SharePoint 2013 after upgrading from 2010 and getting following error then perform  the steps mentioned below to resolve this issue.

SharePoint Designer cannot display the item

SharePoint Designer cannot display the item

 

  1. Make sure you have uninstalled SharePoint Designer 2010
  2. Close SharePoint Designer 2013
  3. On the local computer, browse to the following folder:
    • C:\Users\<Replace Your User Name>\AppData\Local\Microsoft\WebsiteCache
    • Example: C:\Users\mark.lee.contoso\AppData\Local\Microsoft\WebsiteCache
  4. Delete everything in WebsiteCache folder.
  5. On the local computer, browse to the following folder:
    • C:\Users\<Replace Your User Name>\AppData\Roaming\Microsoft\SharePoint Designer\ProxyAssemblyCache
    • Example: C:\Users\mark.lee.contoso\AppData\Roaming\Microsoft\SharePoint Designer\ProxyAssemblyCache
  6. Delete everything in ProxyAssemblyCache folder.
  7. Done.
  8. Open SharePoint Designer 2013 and make the changes to your site as needed.

This happens due to cached .NET assemblies in above mentioned folders. These cached files confuses  SPD2013 to use older .NET code which is not compatible with SP2013.

Share
Filed in SharePoint 2013, SharePoint Designer 2013, Solutions, Tips, Troubleshooting, Workflow • Tags: , , ,

Current Item Url in SharePoint Workflow

By Namwar Rizvi - Last updated: Saturday, February 22, 2014

If you want to embed a link to current item in your SharePoint Workflow email or in any other action then use

Workflow Context -> Current Item Url

CurrentItemUrl

 

Share
Filed in Solutions, SP2010, Workflow • Tags: , ,

Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Format

By Namwar Rizvi - Last updated: Sunday, January 19, 2014

If you are preparing for the SharePoint 2013 certification 70-489 i.e. “Developing Microsoft SharePoint Server 2013 Advanced Solutions” then following will be helpful for you with regards to exam format:

For exam content details, skills measured and how to prepare, please refer to the certification page

http://www.microsoft.com/learning/en-us/exam-70-489.aspx

Share
Filed in Certification, Information, SharePoint 2013 • Tags: , ,

Get FormDigest from C# using REST in SharePoint 2013

By Namwar Rizvi - Last updated: Sunday, March 17, 2013

If you want to communicate with SharePoint 2013 through REST, you need to send FormDigest value with every request.
In JavaScript, it is very easy as it will always be available on SharePoint Page where your JavaScript code is executing. It is quite tricky when you need to submit REST requests from C# code as there is no such thing called FormDigest control. Following is a function to get the FormDigest control for your REST request in C#

private static string GetFormDigest(string webUrl)
{
//Validate input
if (String.IsNullOrEmpty(webUrl) || String.IsNullOrWhiteSpace(webUrl))
return String.Empty;

//Create REST Request
Uri uri = new Uri(webUrl + "/_api/contextinfo");
HttpWebRequest restRequest = (HttpWebRequest)WebRequest.Create(uri);
restRequest.Credentials = CredentialCache.DefaultCredentials;
restRequest.Method = "POST";
restRequest.ContentLength = 0;

//Retrieve Response
HttpWebResponse restResponse = (HttpWebResponse)restRequest.GetResponse();
XDocument atomDoc = XDocument.Load(restResponse.GetResponseStream());
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";

//Extract Form Digest
return atomDoc.Descendants(d + "FormDigestValue").First().Value;
}
Share
Filed in C#, Code, SharePoint 2013 • Tags: , ,

Custom Timer Jobs versus PowerShell and Task Scheduler for Scheduled Tasks

By Namwar Rizvi - Last updated: Friday, December 7, 2012

Although I am a great fan of using PowerShell for performing lots of tasks in SharePoint quickly, but there are certain areas where PowerShell may not be the optimum solution.

One of which is Custom Timer Jobs in SharePoint. Although you can schedule a PowerShell script by a task scheduler in windows to run some process on a regular interval but creating a TimerJob will give you long term benefits and manageability.  Next, I will try to compare the two approaches, Your comments are most welcome:

  

Custom Timer Job PowerShell
Configuration Timer Jobs have Property Bags. This will give you power to store configuration data along with specific timer job.
To modify the data, a custom application page can be deployed to Central Admin UI as a link.
In this way, an Admin can manage the job easily through web interface without the need of going to a Shared Folder.
PowerShell script will need either input parameters or a custom config file (preferably XML) for configuration.
To update the configuration data, admin needs to access the Shared Folder or should upload the updated config file through FTP or some other way, which in my opinion is a cumbersome process
User Experience Having a central admin page allows gives a professional and managed user experience with proper branding. User Experience is standard console without any branding.
Training By using standard SharePoint theming and controls, It will be easier for any SharePoint user to quickly learn the usage and management of Timer Job.  Description below each configuration item will reduce/remove the need of separate help document. A separate help documentation will be needed to make sure user remembers the usage of parameters.
OR
Parameter usage will need to be provided with some standard help parameter e.g. /? Or -help
Deployment/Installation A standard WSP solution can be deployed with everything packaged in it without the need of copying multiple dependency files. No standard built in deployment method for PowerShell scripts so administrator has to come up its own way of deployment management.
Retraction/Uninstallation Standard WSP retraction with guaranteed clean of everything initially deployed with the solution. Administrator needs to make sure that every dependency has been cleared.
Application Context Timer Job has the context of Web Application which means it can have a logic to behave differently on per application basis, if needed. By default, PowerShell script can not assume an application context. It needs to create that context, if needed.
Security/Execution Account Timer Jobs always run under specified SharePoint account which gives them specific level of access as per Administrator needs. PowerShell script can also run under a specific account but you need to specify it in Task Scheduler.
This mean another administration task for an administrator.
Backup/Restore Schedule of Timer Job will be backed up and restore in your normal process of SharePoint backup and restore. Administrator needs to manually manage backup and restore of Schedule Tasks and their PowerShell scripts.
Multiple Instances Custom Timer Jobs provides the power to specify Job LockTypes (i.e. SPJobLockTypes) which guarantees that multiple instances of same job will never execute at the same point in time. No multiple instance guarantee. Administrator needs to make sure that no two instances are running at the same time.
Load Balancing To reduce the load on SharePoint Servers, administrator can specify to run the job on all servers, in one particular server, or only the front end servers. Administrator needs to manually schedule a script on some specific server.
Execution Time Window In a farm environment, where a job is setup to run on all server, SharePoint automatically selects the server and a time window of few minutes to start the job as per schedule. It greatly improves the execution reliability. No execution time window management.
Development Complex, as it needs Visual Studio and C#/VB.Net and development skills Easy, as no special development tool is needed. A notepad will be enough.
Debugging Complex but more powerful as it needs the knowledge of how to attach the debugger to the running process. Easy but less powerful as you have to print the messages for debugging.
Share
Filed in Administration, Architecture, Concepts, Management, SP2010, Timer Jobs • Tags: , , , , , , , ,

SharePoint 2013 beta announced

By Namwar Rizvi - Last updated: Tuesday, July 17, 2012

Microsoft has announced the new version of SharePoint  i.e. SharePoint 2013. It is in beta version right now and can be downloaded from SharePoint site http://sharepoint.microsoft.com/en-us/preview/sharepoint.aspx

To get the better idea of what is coming in next version of SharePoint, please check the Microsoft presentations at http://www.microsoft.com/en-us/download/details.aspx?id=30361

For developers, there are training videos available at http://msdn.microsoft.com/en-US/office/apps/fp123626

One of the big news from developer’s perspective is “SharePoint Apps“. Yes, you read correctly, SharePoint now has the App model which means you can create widgets, full blown applications or just a web page to provide a specific functionality.

To get the better idea of new functionalities in SharePoint 2013, check following video

http://msdn.microsoft.com/en-US/sharepoint/fp123576?videoId=9b5540f2-6e04-4ae8-bb71-fbfdf8634a96&from=sharepermalink&src=v5:share:sharepermalink:

 

Share
Filed in Information, SharePoint 2013 • Tags: , ,

How to detect if the given webpage is generated by SharePoint?

By Namwar Rizvi - Last updated: Tuesday, June 5, 2012

If you want to find out whether the given web page is generated by SharePoint or not then the most authentic way of verification is to check Response Headers. SharePoint adds an specific response header (along with others) called

MicrosoftSharePointTeamServices

The presence of this header is a proof that the given web page is served by SharePoint. The value of MicrosoftSharePointTeamServices header will be similar to 14.0.0.xxxx where major version 14 means it is SharePoint 2010.

 

The quickest way to check the response header is to use fiddler . For example,

Response Header of a SharePoint Page

 

Warning:

As any web server is allowed to add any Response Header therefore, please make extra checks if there is a mission critical dependency on this check.

Share
Filed in Architecture, Concepts, Information, SP2010 • Tags: , , , , ,

Difference between Security Context of Workflow Code in SharePoint 2007 and 2010

By Namwar Rizvi - Last updated: Wednesday, May 16, 2012

In SharePoint 2010, any code which executes because of the changes made by the workflow process will run in context of the user who either started the workflow or responsible for changes which caused the code to be executed.

But …

In SharePoint 2007,  any code which executes because of the changes made by the workflow process will always run in context of SharePoint\System.

Due to the above difference, your SharePoint 2007 code will be able to perform anything on your Site as it will always have Full Permissions whereas in SharePoint 2010, it will depend on the user permission. If you are porting your code from 2007 to 2010 and will need full permission then you should consider using SPSecurity.RunWithElevatedPrivileges method. For details on it, click here

Share
Filed in Architecture, Code, Information, Security, SP2010, Tips, Tools, Troubleshooting, Workflow • Tags: , , , , , , ,