Querying Sharepoint authentication RRS feed

  • Question

  • Hi,

    I've been presented a task at work and I'm hoping I can get a little guidance on the quickest way to do it. I have an Excel 2003 sheet with a list of 8K hyperlinks to documents stored on our internal portal (In sharepoint). Each of the documents should have restricted access, however on a 5% test a lot don't.

    The task is to come up with a way to highlight all of the documents that don't ask for a username and password when the hyperlink is clicked. It is possible for me to move this sheet into either Excel 2007 or an SQL database if it is necessary to complete the task. I'm also open to suggestions using other softwares if there is a chance they will work. 

    Any advice on this is greatly appreciated. 


    • Moved by Mike Walsh FIN Monday, October 19, 2009 1:11 PM Doubt if Excel Services - looks like 'Excel+SharePoint' (From:SharePoint - Excel Services)
    Monday, October 19, 2009 12:51 PM

All replies

  • The easiest way to accomplish this task is via a PowerShell script.

    I put together for you a quick script that should give you what you need.  The script will read a text file containing a list of URLs (make sure to modify the source file path with your own path), and then call a function for each URL.  This function will open a new instance of IE, navigate to the URL, wait for the page to load, and then grab the title of the page.  If the user doesn't have access to the page, the page title will contain "Access denied"; otherwise, the page title will be returned.  Run this script under the credentials of one of your end users.  If you're trying to open individual documents (Word, Excel, etc.), you may need to modify the script so that it launches correct application (and closes it when done).

    Please post your feedback here so that others may benefit from your experiences.

    # This script will read a text file containing a list of URLs and attempt to connect to each URL.  Successful connection will return the page's title; otherwise, the script will return Access denied error.
    # OpenIE function starts here...
    # This function launches a new instance of IE and then navigates to the specified URL
    function OpenIE($url)
    if ($url -notlike "http://*")
    $url = "http://" + $url
    $ie = new-object -com "InternetExplorer.Application"
    $ie.Visible = $true
    # wait for IE to load the page
    While( $ie.Busy )
    # grab page title - if access is denied, the page title will say so
    $Title = $ie.Document.Title
    return $Title 
    # *** Main script routine starts here ***
    # specify your source file path here...
    $SourceFilePath = "C:\Shared\list.txt"
    write-host "Starting script..."
    # read the source file into an array of strings, iterate through each one
    $list = Get-Content $SourceFilePath
    foreach ($item in $list)
    $result = OpenIE($item)
    write-host $item, ";" , $result
    write-host "Finished."

    Andre Galitsky, MCTS, Lexington, KY -- My SharePoint Blog:
    Wednesday, October 21, 2009 1:19 PM