I'm trying to create a team site and get the following error message

Site url https://myurl/sites/mylongsitename exceeds maximum length of 256.

The url itself is under the 256 limit, I've also tried appending "Shared Documents" and "Shared%20Documents" and its still under the limit. Does anything else get appended to increase the length.

Is there a way for me to validate this before attempting to create it?

This is the code I am using source

 using (ClientContext tenantContext = new ClientContext("https://yoursite-admin.sharepoint.com/"))
            //Authenticate with a Tenant Administrator
            SecureString passWord = new SecureString();
            foreach (char c in "password".ToCharArray()) passWord.AppendChar(c);
            tenantContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);

            var tenant = new Tenant(tenantContext);

            //Properties of the New SiteCollection
            var siteCreationProperties = new SiteCreationProperties();

            //New SiteCollection Url
            siteCreationProperties.Url = "https://yoursite.sharepoint.com/sites/codesite";

            //Title of the Root Site
            siteCreationProperties.Title = "Site Created from Code";

            //Email of Owner
            siteCreationProperties.Owner = "[email protected]";

            //Template of the Root Site. Using Team Site for now.
            siteCreationProperties.Template = "STS#0";

            //Storage Limit in MB
            siteCreationProperties.StorageMaximumLevel = 100;

            //UserCode Resource Points Allowed
            siteCreationProperties.UserCodeMaximumLevel = 50;

            //Create the SiteCollection
            SpoOperation spo = tenant.CreateSite(siteCreationProperties);


            //We will need the IsComplete property to check if the provisioning of the Site Collection is complete.
            tenantContext.Load(spo, i => i.IsComplete);


            //Check if provisioning of the SiteCollection is complete.
            while (!spo.IsComplete)
                //Wait for 30 seconds and then try again

            Console.WriteLine("SiteCollection Created.");


The total length of the url is 148

  • mpore information required. what are the exact length of the url? how you trying to create the site?
    – Waqas Sarwar MVP
    Mar 3, 2015 at 18:19
  • updated question
    – Webfort
    Mar 3, 2015 at 19:10
  • Don't you have any zone (alternate access mapping, AAM) that has a URL that may cause exceeding the limitation?
    – pholpar
    Mar 3, 2015 at 20:38
  • Not that I know of. How do I find out?
    – Webfort
    Mar 3, 2015 at 20:41
  • Central Administration / Application Management / Configure alternate access mappings (Web Applications)
    – pholpar
    Mar 3, 2015 at 21:38

1 Answer 1


I think I have solved this, well from the tests I have done.

It appears if the url is greater than 136 characters you will get this error.

http://tenant/sites/mysitename "This can not be great than 136 characters"

I've tried this on two different tenants

you also have to factor in "sites" - "teams".

This is the only way I can see of validating a site collection. If I'm wrong please let me know.

I've updated this post with a screen shot. The highlighted textbox has a dynamic max length.

Site Collection Creation Screen Shot

  • Strange. These numbers seem not to correspond to the values officially published at technet.microsoft.com/en-us/library/ff919564.aspx.
    – pholpar
    Mar 4, 2015 at 9:25
  • I'm only going on what I have tested. Unless any additional validation is done on the server before creation. Maybe something else is appended on to the end of a site address ie Shared Documents/All.aspx. I'm open to any other suggestions. Even with appending the above I'm still within the limit.
    – Webfort
    Mar 4, 2015 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.