mercredi 3 décembre 2014

CSOM And FieldURLValue Error



I am trying to set a URL Field to update the Description and every time i run this ClientSide (via Powershell) I get the following error Exception calling "ExecuteQuery" with "0" argument(s): "Invalid URL: Microsoft.SharePoint.Client.FieldUrlValue


Basically what I'm trying to do is to set the URL to a Folder in a Document Library for a Specific User


The List will show


Users Name


Dept


Team


Document Library URL


Currently it shows it all correctly however its not that nice to see a huge URL in the Document Library URL field hence I want to Update it to show the Description which should show "User's Documents"


Easy done on Server Side and i have it Working on Server Side - However I would like to set this Client Side


So an example is


Ryan


IT


SharePoint



$url = $item["Document_x0020_Url"].url
$ofldurl= new-object Microsoft.SharePoint.Client.FieldUrlValue
$ofldurl.URL = $url
$ofldurl.Description = $item["Title"]+"'s"+" "+"Documents"
$item["Document_x0020_Url"] = $ofldurl
$item.update()
$context.ExecuteQuery()


I have double Checked and the URL is Set correctly in the Class (or at least it seems it to me) below is the output from the FieldURLValue Variable I had Created


Url


http://ift.tt/1yNXA9k


Description


Ryan's Documents


TypeId


{fa8b44af-7b43-43f2-904a-bd319497011e}


Can Anyone see why this is not working at all or is this just me having a bad day?








0 commentaires:

Enregistrer un commentaire