Get List Template from Project Site using CSOM Project Online

Get List Template from Project Site using CSOM Project Online. Get .stp file from Project Site using CSOM Project Online

Get List Template from Project Site using CSOM programmatically Project Online.When we move SharePoint list or Document Library from one Project Site to another Project Site then we need to save a list as in .stp format file, called SharePoint list template. We can manually create .stp file. But when we need to create list template in bulk then we need to write code. So below is code to Getting List Template from Project Site using CSOM Project Online.

[AdSense-A]

 
using (ClientContext clientContext = new ClientContext(pwaPath))
            {
                SecureString passWord2 = new SecureString();
                foreach (char c in Passwords.ToCharArray()) passWord2.AppendChar(c);
                clientContext.Credentials = new SharePointOnlineCredentials(UserName, passWord2);
                Web site = clientContext.Web;

                clientContext.Load(site, s => s.ListTemplates);
                clientContext.ExecuteQuery();

                Site siteCollection = clientContext.Site;
                ListTemplateCollection listTemplateList = siteCollection.GetCustomListTemplates(site);
                clientContext.Load(listTemplateList);
                clientContext.ExecuteQuery();
                ListCreationInformation listCreationInfo;
                listCreationInfo = new ListCreationInformation();
                List list;
                foreach (ListTemplate listTemplate1 in listTemplateList)
                {
                    string Name = listTemplate1.Name;
                }
            }

Some useful Links are below

Download List Template from List Template Gallery Programmatically using CSOM

Get Project Site URL using CSOM Programmatically

Add TimeSheet Line Classification using CSOM Project Online

Add actual Hours in TimeSheet using CSOM Project Online

Read TimeSheet Data using CSOM Project Online

Read project level lookup type custom field has multiple values using csom

Read Task Level Lookup Type Custom Field using CSOM

Update Lookup Type Custom Field using CSOM


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!