Thursday 7 April 2016

2 Quick Errors & Solutions in SharePoint 2013.

     Hi all, in this blog I want to quickly describe about the 2 errors that I faced in this week in my "New SharePoint development". 

New??? 

     Ya, for almost 2 years I missed with SharePoint. I could tell you my career started by learning SharePoint only. Did vast development that includes, OOB features, Web Parts, Event Receiver, Service Applications. But for the bread and butter, I have switched off from it, but where ever went I wrote some code to handle file upload/download into the SharePoint document library.  But the core development has missed. You can't work with SharePoint as a side kick project at your home, unless you were developing an Enterprise Application. So, I always have deep pain of missing this application framework.

You could ask me, What's so special in that?

For an End-User view, it's a document storage repository, again for web designers, its a Content Management System and for Developers it's a HELL. (all the time to dealt with the Correlation-IDs, URLs, :P )

According to me, it's an 

 "Application Framework".

You may all know that Frameworks makes the Developer's Life Easy. Same way, if you want to develop an application, without writing tons of codesyou could achieve the other subsidiary modules apart from your own business logic, sometime it could finish module for your business needs if they are more general. Some of the basic app needs that could be addressed by SP,

1. User Management - Served via User Profile Applications.

2. Document Management - Microsoft's office integration, with versioning in form of Document Library.

3. Search - Can configure Search Services [Fast Search].

4. Business Workflow - SP Workflows will do the needful.

And much more....

Let's move to the topic:

Error 1: While running your SharePoint solution, using VS. You may see the following error, sometimes,

Platform Not Supported Exception
Solution

1. Right click your solution, on properties page, turn your build Platform Target to Any CPU or X64.

2. Else, from VS Tools menu, go to Options, set the VS to use 64-bit IIS Express, like below.



Error 2:

      On writing code, for the SharePoint List Item: Insert / Update "The security validation for this page is Invalid. Click back in your web browser, refresh the page, and try your operation again".

Solution

Maintain your locks., properly..

currentWeb.AllowUnsafeUpdates = true;
// update your items.
currentWeb.AllowUnsafeUpdates = false;


Happy Coding :)

No comments:

Post a Comment