dev tester

dev tester

  • NA
  • 14
  • 5.1k

Sharepoint client object model “File not found” Powershell

May 21 2019 8:29 AM

Hello, I have some issue when i try to create a folder or a file with CSOM and PowerShell.

This is a sample of my code to create a folder :

  1. $web_sp = $session_sp.Web    
  2. $session_sp.Load($web_sp)    
  3. $session_sp.ExecuteQuery()    
  4.     
  5. $folder = $web_sp.GetFolderByServerRelativeUrl(($urlGed.Valeur+'/'+$ObjGed.Valeur+'/Commandes'))    
  6. $session_sp.Load($folder)    
  7. $session_sp.ExecuteQuery()    
  8.   
  9. # at this moment if I check $folder.ServerRelativeUrl it returns the good url so I thinks it means it's loaded correctly    
  10.     
  11. $myNewFolder = $folder.Folders.Add('NewFolder') # Here no exeption    
  12.     
  13. $session_sp.Load($myNewFolder) #Folder or Folder.Folders    
  14. $session_sp.ExecuteQuery()         

at the last ExecuteQueryan an exception has occurred ("File not found")
(When I use the Sharepoint web page I can create folder and file so I think I have the acces rigth


Answers (1)