+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / You are not authorized to 'Modify library and manage documents' ('Document').

You are not authorized to 'Modify library and manage documents' ('Document').

3 posts, 0 answered
  1. Ron
    Ron avatar
    4 posts
    Registered:
    27 Jul 2010
    13 May 2011
    Link to this post
    Hi,

    I know I need to set the Provider for my document library to SuppressSecurityChecks to false.

    I'm not sure how to do that -

    Here is some code that I found in the documentation to upload a document into a library, however when I do so I get a 'Not authorized' error

    How do I access the provider for a document library?

    Thanks!

    Ron



     

     

    public void UploadDocumentFluent(Guid parentID, string documentName, string description, string path)

     

     

    {

     

     

     

    //get a document file from file system

     

    System.IO.

     

    FileInfo docFile = new System.IO.FileInfo(path);

     

     

     

     

    App.WorkWith()

     

     

    .DocumentLibrary(parentID)

     

    .CreateDocument()

     

    .Do(d =>

     

    {

     

    d.Title = documentName;

     

    d.Description = description;

     

    })

     

    .CheckOut()

     

    .UploadContent(docFile.OpenRead(), docFile.Extension)

     

    .CheckInAndPublish()

     

    .SaveChanges();

     

    }

  2. Ron
    Ron avatar
    4 posts
    Registered:
    27 Jul 2010
    13 May 2011
    Link to this post
    I figured it out -

    App

     

     

    .WorkWith().DocumentLibrary(parentID).GetManager().Provider.SuppressSecurityChecks = true;

     


    before trying to upload the doc

    thnx

    Ron

  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 May 2011
    Link to this post
    Hello Ron,

    Another option is using a user with proper permissions. SuppressSecurityChecks is suggested only for particular cases, since it grants full access over the objects.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

3 posts, 0 answered