質問

I ran into a problem when programmatically creating a new site in SharePoint Online. I try to run it from a webpart. On-premise everything is working like a charm, but when I deploy it to SharePoint Online it generates an error occasionally. If I change the site name in my textbox after I get an error and retry, it works well.

I get the following exception:

Microsoft.SharePoint.SPException: The Web site address "/nederlands/blablablablalblasd" is already in use. ---> System.Runtime.InteropServices.COMException: 0x800700b7The Web site address "/nederlands/blablablablalblasd" is already in use. at ..............

The webpart has to create a site and create a group for the site. Group members are populated from listitems. The code I use is:

        using (SPSite currentSite = SPContext.Current.Site)
        {
            using (SPWeb currentWeb = currentSite.OpenWeb())
            {
                try
                {
                    SPWeb site = null;
                    uint lcid = currentWeb.Language;
                    string templateName = "WIKI#0";
                    site = currentWeb.Webs.Add(siteName.Text, siteName.Text, siteDesc.Text, lcid, templateName, true, false);
                }
                catch (Exception exception)
                {
                    DebugUsingLiteral(exception.ToString());
                }
            }
        }

Hope you can help me out.

役に立ちましたか?

解決

Ended up by switching from a webpart to an App. In my opinion SharePoint 2013 Online and CSOM is a much better combination.

It also gives yout the ability to debug your solutions in the SPOnline environment.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top