Problem restoring file

Sep 8, 2014 at 12:04 PM
Edited Sep 8, 2014 at 3:56 PM
Hi Guys,

I've got the backup functionality working, however im struggling to restore. when i try i get the below error and a malformed gui box. I've checked my Sharepoint permissions and i have full control on this document library.

I've looked at line 335 - $wsUri = "$SavePSToSP_DocLibPath/_vti_bin/Lists.asmx" and the value of $wsuri is the correct url for "list web service" page in Sharepoint, however if execute "New-WebServiceProxy -Uri $wsUri" i get an access denied.

Is this something you've seen before?

New-WebServiceProxy : The request failed with HTTP status 401: Unauthorized.
At C:\Users\MyUsername\Documents\WindowsPowerShell\Modules\SavePSToSP\SavePSToSP.psm1:335 char:18
  • $proxy = New-WebServiceProxy -Uri $wsUri
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (http://cioshare..._bin/Lists.asmx:Uri) [New-WebServiceProxy], WebExcep
      tion
    • FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.NewWebServiceProxy
      The property 'Credentials' cannot be found on this object. Verify that the property exists and can be set.
      At C:\Users\MyUsername\Documents\WindowsPowerShell\Modules\SavePSToSP\SavePSToSP.psm1:337 char:9
  • $proxy.Credentials = $NetworkCredentialToUse
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At C:\Users_MyUsername_\Documents\WindowsPowerShell\Modules\SavePSToSP\SavePSToSP.psm1:338 char:9
  • $listItems = $proxy.GetListItems($spListName, $null, $null, $null, $null ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Sep 10, 2014 at 1:33 PM
the problem seems to be with the Credentials, changing to the below (althought it gives me an extra pop up) seems to work.

$proxy = New-WebServiceProxy -Uri $wsUri -Credential (Get-Credential)

$proxy.Credentials = $NetworkCredentialToUse

it this actually a bug or have i done something stupid?
Coordinator
Sep 21, 2014 at 2:28 PM
cgfootman,

I haven't worked on this project in a few years so I may be rusty in troubleshooting it. Can you try putting the list web service URL that you are using into a web browser and see what the result is? If you still get access denied or an error message you may need permissions at the site level or there is an issue with the permissions on the folder on the web server where this file is hosted.

Brian T. Jackett
Sep 23, 2014 at 8:18 PM
Hi Brian,

Thanks for the reply, I've resolved the permissions issue but I still get...

You cannot call a method on a null-valued expression.
At C:\Users_MyUsername_\Documents\WindowsPowerShell\Modules\SavePSToSP\SavePSToSP.psm1:338 char:9
•$listItems = $proxy.GetListItems($spListName, $null, $null, $null, $null ...
•~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ◦CategoryInfo : InvalidOperation: (:) [], RuntimeException
◦FullyQualifiedErrorId : InvokeMethodOnNull


I'm sure its the .getlistitems(..) part but I can't find - I guess dumb enough - instructions on how this relates to my document library, if I change the number of $null I get the same error and the other examples I have seen of this command seems to have data in them. Would these need to change depending on the number/type of columns/data in the library? if so do you know of any articles that explain this or can you suggest what I need to read up on? I love this project and I know its going to add a lot of value once Its working in our environment

Regards,

Chris