Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i am trying to enable versioning on a ducument library using the client object model my code currently is as follows when i create the document library.

            ClientContext clientContext = getClientContext();
        try
        {
            Web web = clientContext.Web;
            ListCollection listCol = web.Lists;
            ListCreationInformation lci = new ListCreationInformation();
            lci.Title = DocLib;
            lci.TemplateType = (int)ListTemplateType.DocumentLibrary;
            List documentLibrary = listCol.Add(lci);
            documentLibrary.EnableVersioning = true;
            documentLibrary.EnableMinorVersions = true;
            documentLibrary.ContentTypesEnabled = true;
            clientContext.Load(listCol);
            clientContext.ExecuteQuery();
            Console.WriteLine("doclibCreated created");
            return documentLibrary;
        }
        catch (Microsoft.SharePoint.Client.ServerException e)
        {
            Console.WriteLine(e.Message);
            return null;
        }

but these settings are not persisted

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to call Update() to apply document library properties:

.
.
documentLibrary.ContentTypesEnabled = true;

documentLibrary.Update();   <---- ADDED

clientContext.Load(listCol);
.
.
share|improve this answer
    
ah yes that makes sense thatnks alot :) –  Sebastien Stettler Oct 4 '11 at 13:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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