Home WinHttpRequest using users own ActiveDirectory credentials
Reply: 0

WinHttpRequest using users own ActiveDirectory credentials

user938
1#
user938 Published in June 18, 2018, 3:39 am

I'm using the following code to grab an image (of a part held on a SharePoint site) to display in an excel sheet. I'd like to use the user's own Active Directory credentials to access the url. The code I've got so far is:

Dim Request As Object
Dim ResponseStatus As Variant
Dim ImgURL As String
ImgURL = "https://someValidURL/" & ExtraPartNo & ".jpg"

    Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")

    With Request
        .Open "GET", ImgURL, True
        .Send
        .WaitForResponse
        ResponseStatus = .StatusText
    End With
    Set Request = Nothing

    If ResponseStatus = "OK" Then
        ImgURL = "https://someValidURL/" & ExrtaPartNo & ".jpg"
    Else
        SetterImgURL = "https://someValidURL/AwaitingImage.jpg"
    End If

The idea is to display an image of a part if it exists but if it doesn't then display the AwaitingImage.jpg

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30077 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO