Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Unknown Error..while creating a site

$
0
0

Hello All,

I am trying to create a site using .net managed client object model

I want to use my custom site template

following is the code

 string SiteDescription = "About Avatar";
            int SiteLanguage = 1033;
            string SiteTitle = "Avatar";
            string SiteUrl = "Avatar";
            bool SitePermissions = false;
            string mywebTemplate = "{985F9B01-8CC8-448E-9E93-B89A1C332D37}#Avatar";

            ClientContext clientContext = new ClientContext("http://myserver/mysite");


            Web oWebsite = clientContext.Web;

            //Create a new webCreateInformation object to specify the properties of the new site being created.

            WebCreationInformation webCreateInfo = new WebCreationInformation();
            webCreateInfo.Description = SiteDescription;
            webCreateInfo.Language = SiteLanguage;
            webCreateInfo.Title = SiteTitle;
            webCreateInfo.Url = SiteUrl;
            webCreateInfo.UseSamePermissionsAsParentSite = SitePermissions;
            webCreateInfo.WebTemplate = mywebTemplate;


            Web oNewWebsite = oWebsite.Webs.Add(webCreateInfo);

            // Retreiving the server properties to the client context. Here we are retreiving the web server url and the time it was created.

            clientContext.Load(oNewWebsite,
                Website => Website.ServerRelativeUrl,
                Website => Website.Created);

            // Executes the query to retreive the required information from the server.
            clientContext.ExecuteQuery();

I am getting unknown error.

How to trace the correct error?


Like Cricket


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>