How to create Visio Process Repo Site collection programmatically using CSOM?

Yuvraj Patil 441 Reputation points
2023-05-24T12:49:24.35+00:00

Hi,

I would like to create a Visio Process Repository site collection using CSOM, could you please tell me the Template to be used to create this site collection and sample code as well.

Visio Process Repo

Thanks,
Yuvraj.

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-05-25T05:30:39.66+00:00

    Hi @Yuvraj Patil,

    The Visio Process Repository site template id is visprus#0. Per my test, I can create a site by following code

                    var tenant = new Tenant(tenantContext);
    
                    //Properties of the New SiteCollection
                    var siteCreationProperties = new SiteCreationProperties();
                    //New SiteCollection Url
                    siteCreationProperties.Url = "https://xxx.sharepoint.com/sites/codesite02";
                    //Title of the Root Site
                    siteCreationProperties.Title = "Site Created from Code02";
                    //Email of Owner
                    siteCreationProperties.Owner = "xxx";
                    //Template of the Root Site. Using Team Site for now.
                    siteCreationProperties.Template = "visprus#0";
                    //Storage Limit in MB
                    siteCreationProperties.StorageMaximumLevel = 100;
                    //UserCode Resource Points Allowed
                    siteCreationProperties.UserCodeMaximumLevel = 50;
    
                    //Create the SiteCollection
                    SpoOperation spo = tenant.CreateSite(siteCreationProperties);
    
                    tenantContext.Load(tenant);
                    tenantContext.Load(spo, i => i.IsComplete);
                    tenantContext.ExecuteQuery();
    
                    //Check if provisioning of the SiteCollection is complete.
                    while (!spo.IsComplete)
                    {
                        //Wait for 30 seconds and then try again
                        System.Threading.Thread.Sleep(30000);
                        spo.RefreshLoad();
                        tenantContext.ExecuteQuery();
                    }
    
                    Console.WriteLine("SiteCollection Created.");
    
    
    
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.