Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- New-WebServiceProxy : The request failed with HTTP status 401: Unauthorized.
- At C:ScriptsGetItemID_UsingWebServices.ps1:1 char:26
- + $WS = New-WebServiceProxy <<<< -uri http://server/sites/promo/_vti_bin/SiteData.asmx
- + CategoryInfo : ObjectNotFound: (http://server...n/SiteData.asmx:Uri) [New-WebServiceProxy], WebExcept
- ion
- + FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.NewWebServiceProxy
- Property 'Credentials' cannot be found on this object; make sure it exists and is settable.
- At C:ScriptsGetItemID_UsingWebServices.ps1:2 char:5
- + $WS. <<<< Credentials = [System.Net.CredentialCache]::DefaultCredentials
- + CategoryInfo : InvalidOperation: (Credentials:String) [], RuntimeException
- + FullyQualifiedErrorId : PropertyNotFound
- You cannot call a method on a null-valued expression.
- At C:ScriptsGetItemID_UsingWebServices.ps1:12 char:26
- + $GUS = $WS.GetURLSegments <<<< ($ItemURL, $webID, $bucketID, $strListID, $strItemID)
- + CategoryInfo : InvalidOperation: (GetURLSegments:String) [], RuntimeException
- + FullyQualifiedErrorId : InvokeMethodOnNull
- $WS = New-WebServiceProxy -uri http://server/_vti_bin/SiteData.asmx
- $WS.Credentials = [System.Net.CredentialCache]::DefaultCredentials
- #$WS.Credentials = [System.Net.NetworkCredential]::("user", (ConvertTo-SecureString "password" -AsPlainText -force), "domain")
- $ItemURL = "http://server/sites/promo/sales/testLib/TestFile.txt"
- $GUS = $WS.GetURLSegments($ItemURL, $webID, $bID, $strListID, $strItemID)
- Write-Host $strItemID
- $webID = $null
- $bID = $null
- $strListID = $null
- $strItemID = $null
- $GUS
- $uri = "http://Server/sites/Promo/TestDocLibrary44/_vti_bin/SiteData.asmx"
- $WS = New-WebServiceProxy -uri $uri -UseDefaultCredential
- $ItemURL = "http://Server/sites/Promot/TestDocLibrary44/2011102100006b.pdf"
- $GUS = $WS.GetURLSegments($ItemURL, [REF]$webID, [REF]$bID, [REF]$strListID, [REF]$strItemID)
- write-Host $strItemID.value # returning null or blank
- write-Host $webID # returning null or blank
- Write-Host "Test "
- $WS.Credentials = [System.Net.NetworkCredential]::("USERNAME", (ConvertTo-SecureString "PASSWORD" -AsPlainText -force))
- $WS.Credentials = [System.Net.NetworkCredential]::("USERNAME", (ConvertTo-SecureString "PASSWORD" -AsPlainText -force), "DOMAIN")
- $WS = New-WebServiceProxy -uri http://server/sites/promo/sales/_vti_bin/SiteData.asmx
- $WS.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
- $ItemURL = "http://server/sites/promo/sales/testLib/TestFile.txt"
- $GUS = $WS.GetURLSegments($ItemURL, $webID, $bID, $strListID, $strItemID)
- Write-Host $strItemID
- $username = "username"
- $password = "password"
- $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
- #assign $cred to the webServicesProxy.Credentials
- $webServicesProxy.Credentials = $cred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement