Cannot create list in SharePoint 2010 using Client Object Model?

Up vote 1 down vote favorite share g+ share fb share tw.

I am trying to utilize SharePoint 2010 Client Object Model to create a List based on a custom template. Here's my code: public void MakeList(string title, string listTemplateGUID, int localeIdentifier) { string message; string listUrl; ListTemplate template; ListCreationInformation listInfo; ListTemplateCollection templatesCollection; try { listUrl = title. Replace(spaceChar, string.

Empty); templatesCollection = clientContext.Site. GetCustomListTemplates(clientContext. Web); clientContext.

Load(templatesCollection); clientContext.ExecuteQuery(); foreach (ListTemplate t in templatesCollection) { if (t. InternalName == listTemplate) { template = t; break; } } listInfo = new ListCreationInformation(); listInfo. TemplateType = template.

ListTemplateTypeKind; //listInfo. TemplateFeatureId = template. FeatureId; listInfo.

Url = listUrl; listInfo. Title = title; listInfo. Description = string.

Empty; listInfo. QuickLaunchOption = QuickLaunchOptions. On; site.Lists.

Add(listInfo); clientContext.ExecuteQuery(); return RetrieveList(title, listUrl); } catch (ServerException ex) { //... } } A few unexpected things happen when this code is run: My template is derived from the default document library template. Now, the code above does not create the document library based on my template - it creates the default document library instead. If I uncomment the //listInfo.

TemplateFeatureId = template. FeatureId; the code throws the ServerException error: "Cannot complete this action. Please try again.

" If I place listInfo. TemplateFeatureId = template. FeatureId; before listInfo.

TemplateType = template. ListTemplateTypeKind; the end result is the same as under item 1 - the default document library is created. Could anyone please help me realize what am I doing wrong?

Thanks. Sharepoint2010 link|improve this question asked May 19 '10 at 15:31Boris1,2131233 87% accept rate.

Duplicate of social.msdn.microsoft.com/Forums/en/shar... – Rob Windsor May 21 '10 at 15:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send