Tuesday, 5 January 2016

SharePoint Development Basics Part 1

The goal of this series is to create very basic projects for SharePoint in Visual Studio. Many times, we have starting trouble. If you are new to SharePoint, this tutorial can lay foundation for excellence in the existing SharePoint work you. You may already be developing or maintaining codes without understanding. After this series, hopefully, what seems complex is actually simple. The same code to retrieve a SharePoint object property would be done from simple Console to complex Solutions.

My favourite is C# Console Application and was actually first struggling to get the code running. On third day, magically the code ran after testing the SPSite against GUID instead of actual Url. In case you get errors like "The Web Application cannot be found..", check the following:
1. Run Visual Studio as Administrator
2. Set target platform to x64
3. .NET framework 4.5
4. Test the code against ID instead of string parameters which might have type error.

Generic steps for a SharePoint Development Project:
1.Open Visual Studio
2.Create New Project(x64)
3.Add SharePoint dll (from hive) [C:\ProgramFiles\Common Files\Microsoft shared\web server extentions\15\ISAPI]
4.Add using directive [Microsoft.SharePoint]
5.Write code
6.Debug

Below is the video illustrating the detailed steps for a simple Console Application reading the Site Collection properties:



No comments:

Post a Comment