+ Reply to Thread
Results 1 to 2 of 2

Checking Accesright for Sharepoint Folder using VBA

  1. #1
    Forum Contributor
    Join Date
    06-09-2011
    Location
    Germany
    MS-Off Ver
    Excel 2016
    Posts
    194

    Checking Accesright for Sharepoint Folder using VBA

    Hi all,

    I have developed a tool which requires users having write access for a folder stored on a sharepoint. While all users have read access, not all of them are able to write. Therefore my tool should check first if they have write access.

    I did find some code on the intranet, but this only works on "normal" network drives. Ideally the code should give me a "TRUE" if the user does have Write Access and "FALSE" if he doesn't.

    What I have tried so far was the "cancheckout" command, but this gives me a TRUE regardless of read or write access. Another alternative is to create a textfile on sharepoint - and delete it again afterwards, but this was not really performant.

    The folder path, which I need to check would be in the following format:

    Please Login or Register  to view this content.
    Does anyone have an idea how to do this?

    Regards

    Theo

  2. #2
    Registered User
    Join Date
    11-28-2012
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Checking Accesright for Sharepoint Folder using VBA

    having similiar problem.... Try this. not my code

    Function AuthenticateExcelUser()

    End Function

    Sub login_test()
    On Error GoTo ConnectError

    'Send a bit of text SharePoint as an txt file
    Sheets.Add
    ActiveSheet.Range("A1").Value = 1
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs _
    Filename:="https://sharepointaddress.com/xx/Filename.csv", _
    FileFormat:=xlTextMSDOS
    ActiveSheet.Delete
    Application.DisplayAlerts = True

    'File successfully sent
    MsgBox "Access Granted!"
    'Add some code here to continue application.
    Exit Function

    'File send failed (Probably means they are not authorized)
    ConnectError:
    MsgBox "Access Denied."

    End Function
    Last edited by terps; 11-29-2012 at 09:46 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1