简体   繁体   English

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

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

I ran into a problem when programmatically creating a new site in SharePoint Online. 在SharePoint Online中以编程方式创建新网站时遇到了一个问题。 I try to run it from a webpart. 我尝试从Webpart运行它。 On-premise everything is working like a charm, but when I deploy it to SharePoint Online it generates an error occasionally. 在内部部署中,所有事物都像魅力一样运转,但是当我将其部署到SharePoint Online时,有时会产生错误。 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. Microsoft.SharePoint.SPException:网站地址“ / nederlands / blablablablalblasd”已在使用中。 ---> System.Runtime.InteropServices.COMException: 0x800700b7The Web site address "/nederlands/blablablablalblasd" is already in use. ---> System.Runtime.InteropServices.COMException:0x800700b7该网站地址“ / nederlands / blablablablalblasd”已在使用中。 at .............. 在 ..............

The webpart has to create a site and create a group for the site. Webpart必须创建一个网站并为该网站创建一个组。 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. 最后从Webpart切换到App。 In my opinion SharePoint 2013 Online and CSOM is a much better combination. 在我看来,SharePoint 2013 Online和CSOM是更好的组合。

It also gives yout the ability to debug your solutions in the SPOnline environment. 它还使您能够在SPOnline环境中调试解决方案。

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

相关问题 SharePoint 2013环境中对Office 365(SharePoint Online)的限制是什么 - What are the restrictions on Office 365 (SharePoint Online) in SharePoint 2013 Environment 在Office 365上使用JavaScript创建网站集(在线共享点) - Creating site collection with javascript on office 365 (sharepoint online) Office 365或SharePoint Online中的SPSecurityEventReceiver - SPSecurityEventReceiver in office 365 or SharePoint online 在线授权Office 365 / Sharepoint - Authorization to Office 365/Sharepoint online 在线Sharepoint(Office 365):CEWP - Sharepoint online (Office 365) : CEWP 将文件上传到 SharePoint Online(office 365) 库调用错误 - Upload File To SharePoint Online(office 365) Library Invokes Error 如何使用 sharepoint 在线凭据解决 Office 365 连接错误 - How to resolve Office 365 connection error with sharepoint online credentials 如何通过无缝身份验证从 microsoft word 2013 插件在 office 365 sharepoint 2013 站点中保存文档? - How to save document in office 365 sharepoint 2013 site from microsoft word 2013 addin with seamless authentication? 在Sharepoint Online(办公室365)中显示另一个团队网站的SharePoint列表 - Displaying a SharePoint List from another team site in Sharepoint Online (office 365) 使用Microsoft Office 365 API工具针对Visual Studio 2013的Sharepoint联机文件 - Sharepoint Online Files with Microsoft Office 365 API Tools for Visual Studio 2013
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM