Monday, June 17, 2019

Get All Tenant Site Designs and Save last ID + SharePoint Online

           

/*Get All site designs and noting recent ID */


var customeSiteDesignID = new System.Guid();
using (var tenantContext = new ClientContext(tenentWebUrl))            {
                tenantContext.Credentials = new SharePointOnlineCredentials(uName, securePassword);
                tenantContext.RequestTimeout = Timeout.Infinite;
                //get the tenant object
                Tenant tenant = new Tenant(tenantContext);
                //customeSiteDesignID = tenant.GetSiteDesign(tenantContext, customeSiteDesignID);

                var tenantdesigns = tenant.GetSiteDesigns();
                tenantContext.Load(tenantdesigns);
                tenant.RefreshLoad();

                /*loop All site designs & get oSiteDesign ID -  */
                try
                {
                    tenantContext.ExecuteQuery();
                    foreach (TenantSiteDesign oSiteDesign in tenantdesigns)
                    {
                        customeSiteDesignID = oSiteDesign.Id;
                    }
                }
                catch (Exception ex)
                {
                    log.Info("Error Occured in Getting Site Designs - " + ex.Message);
                }

}




Reference Link :

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/mt846005(v%3doffice.15)


https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/mt846003(v=office.15)



No comments:

Power Automate + Excel data

Extract excel data, get manager and update row with user details which will get from GET MANAGER Concepts and examples Key column:  Column i...