繁体   English   中英

SharePoint 2013 Online(Office 365)创建网站错误

[英]SharePoint 2013 Online (Office 365) create site error

在SharePoint Online中以编程方式创建新网站时遇到了一个问题。 我尝试从Webpart运行它。 在内部部署中,所有事物都像魅力一样运转,但是当我将其部署到SharePoint Online时,有时会产生错误。 如果在收到错误并重试后在文本框中更改了站点名称,则它可以正常工作。

我得到以下异常:

Microsoft.SharePoint.SPException:网站地址“ / nederlands / blablablablalblasd”已在使用中。 ---> System.Runtime.InteropServices.COMException:0x800700b7该网站地址“ / nederlands / blablablablalblasd”已在使用中。 在 ..............

Webpart必须创建一个网站并为该网站创建一个组。 组成员是从列表项中填充的。 我使用的代码是:

        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());
                }
            }
        }

希望你能帮助我。

最后从Webpart切换到App。 在我看来,SharePoint 2013 Online和CSOM是更好的组合。

它还使您能够在SPOnline环境中调试解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM