Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when call SharePoint API

Status
Not open for further replies.

msps12

Programmer
Dec 5, 2011
1
AP
Hi,

I'm having an error when trying to create a new site with SharePoint API. The scenario is:

a) Custom SharePoint workflow calls b) Custom web service calls c) Class library in GAC

The error occur in the class library, the contentDb.Sites.Add throw an exception:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
newSite = contentDb.Sites.Add(newSiteName, newSiteTitle,
newSiteDescription, nLCID, siteTemplate, ownerID,
ownerName, ownerEmail);
});

Below is the exception information:
Windows Identity: serviceaccount001
Current Principal:
IsAuthenticated: False
WebMethodCall: CreateSiteCollection
Url: ExceptionMessage: SoapException
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception:
Object reference not set to an instance of an object.
Error at at Microsoft.SharePoint.Utilities.SPUtility.ValidateFormDigest()
at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName)
at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, Boolean useHostHeaderAsSiteName)
at Microsoft.SharePoint.Administration.SPSiteCollection.Add(String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail)
at EDS.kC.Provisioning.SiteProvisionClass.CreateSiteCollectionInContentDb(String newSiteName, String newSiteTitle, String newSiteDescription, UInt32 nLCID, String siteType, String ownerID, String ownerName, String ownerEmail, String secondaryOwnerID, String secondaryOwnerName, String secondaryEmail) in F:\...\SiteProvisionClass.cs:line 319
at EDS.kC.Provisioning.SiteProvisionClass.CreateSiteCollectionInContentDb(String newSiteName, String newSiteTitle, String newSiteDescription, UInt32 nLCID, String siteType, String ownerID, String ownerName, String ownerEmail, String secondaryOwnerID, String secondaryOwnerName, String secondaryEmail) in F:\...\SiteProvisionClass.cs:line 411
at EDS.SharePoint.Provisioning.SiteProvisionService.<>c__DisplayClass1.<CreateSiteCollection>b__0() in F:\...\SiteProvisionService\SiteProvisionService.asmx.cs:line 72
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at EDS.SharePoint.Provisioning.SiteProvisionService.CreateSiteCollection(String newSiteName, String newSiteTitle, String newSiteDescription, UInt32 nLCID, String siteType, String ownerID, String ownerName, String ownerEmail, String secondaryOwnerID, String secondaryOwnerName, String secondaryEmail) in F:\...\SiteProvisionService\SiteProvisionService.asmx.cs:line 65
--- End of inner exception stack trace ---

If I direct reference the class library in the custom SharePoint workflow without the web service call, the code run successfully and did not throw any error.

Your help is greatly appreciated.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top