Question

I'm trying to create an OOTB team site in a site collection where publishing is enabled.

Not sure what is happening, I've looked into everything from permissions, to TaxonomyHiddenList issues, problems with fields and output cache, but no luck.

Surely it has to do with custom fields/code, but considering what is supposed to be provisioned (Site Assets, Site Pages), I don't understand what could be wrong, and if I indeed have an issue with one of the fields.

System.ArgumentException: Value does not fall within the expected range., StackTrace:   
 at Microsoft.SharePoint.SPField.set_SchemaXml(String value)    
 at Microsoft.SharePoint.SPList.fixFieldShema(SPField fld, String strXml)    
 at Microsoft.SharePoint.SPList.FixFieldsFromColumnTemplate()    
 at Microsoft.SharePoint.SPWeb.SyncNewLists(Boolean bCreateFromSTP)    
 at Microsoft.SharePoint.SPWeb.ApplyWebTemplate(SPWebTemplate webTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)    
 at Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)    
 at Microsoft.SharePoint.ApplicationPages.NewSubwebPage.BtnCreateSubweb_Click(Object sender, EventArgs e)    
 at System.Web.UI.WebControls.Button.OnClick(EventArgs e)    
 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest()    
 at System.Web.UI.Page.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

Output from PowerShell attempt (error 0x80070057)

enter image description here

Similar questions:

https://social.technet.microsoft.com/Forums/en-US/489bcd74-bc1f-4491-b470-897d7f3db32e/cannot-creat-subsite-at-sharepoint-2010-exception-attempting-to-applywebtemplate-to-spweb?forum=sharepointgeneralprevious

https://social.technet.microsoft.com/Forums/office/en-US/8198b434-4264-4931-96b6-df3f6ab767d7/new-blog-site-unknown-sprequest-error-occurred-more-information-0x80070057?forum=sharepointgeneralprevious

Findings:

  • team site creation works fine in other site collections
  • can export an existing team site as template and create a site from that template
  • blank sites, blogs, etc all work fine
  • looking at the reflected code, I should be getting a clearer exception, not sure why it is not coming up in the logs

Code:

// Microsoft.SharePoint.SPList
private void fixFieldShema(SPField fld, string strXml)
{
    bool flag = false;
    System.Guid id = fld.Id;
    SPWeb parentWeb = this.ParentWeb;
    if (!string.IsNullOrEmpty(strXml) && fld.FromBaseType)
    {
        string fieldAttributeValue = fld.GetFieldAttributeValue("Type");
        string b = null;
        string schemaXml = fld.SchemaXml;
        int num = strXml.IndexOf(">", System.StringComparison.OrdinalIgnoreCase);
        int startIndex = schemaXml.IndexOf(">", System.StringComparison.OrdinalIgnoreCase);
        if (num >= 0)
        {
            string text = strXml.Substring(0, num);
            int num2 = text.IndexOf(" Type=", System.StringComparison.OrdinalIgnoreCase);
            if (num2 > 0)
            {
                num2++;
                text = text.Substring(num2);
                num2 = text.IndexOf("\"", System.StringComparison.OrdinalIgnoreCase);
                if (num2 > 0)
                {
                    int num3 = text.IndexOf("\"", num2 + 1, System.StringComparison.OrdinalIgnoreCase);
                    if (num3 > num2)
                    {
                        b = text.Substring(num2 + 1, num3 - num2 - 1);
                    }
                }
            }
            flag = (fieldAttributeValue != b);
            if (fld.Type == SPFieldType.Computed)
            {
                strXml = strXml.Substring(0, num) + schemaXml.Substring(startIndex);
            }
        }
    }
    if (fld.Type == SPFieldType.Lookup && !flag)
    {
        SPFieldLookup sPFieldLookup = fld as SPFieldLookup;
        if (sPFieldLookup != null)
        {
            strXml = this.EnsureLookupFieldSchemaXmlHasList(sPFieldLookup.LookupList, strXml);
        }
    }
    if (!fld.FromBaseType || !flag)
    {
        if (SPLocalizationCollection.HasLocalizations(strXml))
        {
            using (new SPSecurity.SuppressAccessDeniedRedirectInScope())
            {
                try
                {
                    SPLocalizationCollection fieldLocalizations = this.ParentWeb.FieldLocalizations;
                    if (fieldLocalizations != null)
                    {
                        fieldLocalizations.Localize(strXml, out strXml);
                    }
                }
                catch (System.UnauthorizedAccessException)
                {
                }
            }
        }
        try
        {
            if (fld is SPFieldDateTime && parentWeb.RegionalSettings.CalendarType != 1)
            {
                SPField sPField = parentWeb.AvailableFields[id] as SPFieldDateTime;
                if (sPField != null && !string.IsNullOrEmpty(sPField.DefaultValue) && sPField.DefaultValue.EndsWith("Z", System.StringComparison.OrdinalIgnoreCase))
                {
                    System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                    using (System.Xml.XmlTextReader xmlTextReader = new System.Xml.XmlTextReader(new System.IO.StringReader(strXml)))
                    {
                        xmlTextReader.DtdProcessing = DtdProcessing.Prohibit;
                        xmlDocument.Load(xmlTextReader);
                    }
                    System.Xml.XmlElement xmlElement = xmlDocument.DocumentElement.SelectSingleNode("Default") as System.Xml.XmlElement;
                    if (xmlElement != null)
                    {
                        int calendarType;
                        if (!SPGlobal.GetNamedIntItem(xmlDocument.DocumentElement, "CalType", out calendarType) || calendarType == 0)
                        {
                            calendarType = (int)parentWeb.RegionalSettings.CalendarType;
                        }
                        string innerText = xmlElement.InnerText;
                        xmlElement.InnerText = SPUtility.GregorianISOToIntlISODate(parentWeb, innerText, calendarType);
                        fld.SchemaXml = xmlDocument.DocumentElement.OuterXml;
                    }
                    else
                    {
                        fld.SchemaXml = strXml;
                    }
                }
                else
                {
                    fld.SchemaXml = strXml;
                }
            }
            else
            {
                fld.SchemaXml = strXml;
            }
        }
        catch (SPException ex)
        {
            ULS.SendTraceTag(2142736u, ULSCat.msoulscat_WSS_General, ULSTraceLevel.High, "Error Update Field with id '{0}' for list {1} with schema {2},  Exception: {3}", new object[]
            {
                id.ToString("B"),
                this.InternalName,
                strXml,
                ex
            });
        }
    }
}
Était-ce utile?

La solution 2

After looking through a suspicious entry,

SPRequest.UpdateField: UserPrincipalName=i:0).w|s-1-5-21-3732144185-4277010889-2338737342-xxxxx, AppPrincipalName= ,bstrUrl=http://sitecollection/test ,bstrListName={31CA9B5A-5219-4135-850B-BCF53840DF4C} ,bstrXML=<Field ReadOnly="TRUE" Sealed="FALSE" Type="LookupMulti" DisplayName="Taxonomy Catch All Column1" StaticName="TaxCatchAllLabel" Name="TaxCatchAllLabel" ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}" ShowInViewForms="FALSE" Required="FALSE" Hidden="TRUE" CanToggleHidden="TRUE" ShowField="CatchAllDataLab

I went in and opened

http://sitecollection/_layouts/15/FldEditEx.aspx?field=TaxCatchAllLabel

After submitting, it was complaining about a few document libraries.

I decided to re-create them, although I am pretty sure the issue was related to inconsistent metadata values in Managed Metadata columns and the TaxCachAllData field (which can be added in a view programatically).

Now that the field submitted perfectly, I was still getting the same problem, but not in any list/field, just the site creation.

I checked the schema of TaxCatchAllLabel and found a suspicious

UnlimitedLengthInDocumentLibrary="FALSE"

After removing this attribute, everything (i.e. Team Site creation) when back to normal.

Autres conseils

I think you need first to enable Subsites to use any site templates option by doing the following:

  • Go to site setting.
  • Look and feel > Page Layouts and Site Templates.
  • Check Subsites can use any site templates option.

enter image description here

  • Go back to create a subsite with team site below publishing site/team site with the publishing feature, it should be working now.

P.S. I tried it on my side and working properly:)

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top