Archive for December, 2010

SharePoint: Approval Status Value of Publishing Pages

We need to check the approval status of publishing pages through SharePoint Object Model. Following table display values of different status of publishing page:

Approval Status

Value

Approved

0

Rejected

1

Pending

2

Draft

3

Schedule

4

 

We can get values using SharePoint object model

string approvalStatus = pageListIte[“Approval Status”].toString();

Leave a Comment

VS 2010: The Web application at http://URL could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

We faced following error when trying to contact to site through SharePoint Object Model.

System.IO.FileNotFoundException was unhandled

Message=The Web application at http://URL could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Source=Microsoft.SharePoint

StackTrace:

at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)

at Microsoft.SharePoint.SPSite..ctor(String requestUrl)

at InsertWebPart.Program.Main(String[] args) in c:\….\Program.cs:line 14

at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

 

Resolution:

Make following changes in VS 2010 project:

  • Right click on prject -> Properties, Build tab, select x64 from “Platform Target” drop down.
  • Application tab, select “Target farmework” as per your .Net framework. We selected 3.5

Hope this will help.

Comments (3)