Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Refer to a Sharepoint document library field using javascript

  Asked By: Grace    Date: Oct 03    Category: Sharepoint    Views: 2059

Does anyone know a way to refer to doc library field using
javascript? Coz i have a scenario where to refer to a field to read the
value.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Daniel Partridge     Answered On: Feb 28

JQuery and AJAX make this an easier option but basically you can utilize the out of the box SharePoint lists.asm webservice (http://servername/_vti_bin/lists.asmx") getlistitems operation.

To utilize this, you can use the list name (be aware of special characters, spaces, etc. as they internal name is encoded) or you will need the GUID of the list (which I prefer to use.) The GUID can be found in the URL when you go to the list settings, in the list you will see something like:
List=%7DABCD%2DXYA2...SDE%7B

Substitute the following
%7B = "{"
%7D = "}"
%2D = "-"

You will then have a GUID that looks like {ABCD-XYA2...SDE}

The soap envelope would then look something like this:

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:soap='http://schemas.microsoft.com/sharepoint/soap/'>
<soapenv:Body>
<soap:GetListItems>
<soap:listName>YOUR-GUID-HERE (or) YOUR-LIST-NAME</soap:listName>
</soap:GetListItems>
</soapenv:Body>
</soapenv:Envelope>


References:
sharepoint-snippets.com/.../

www.sharepointings.com/.../

msdn.microsoft.com/.../lists.lists.getlistitems(v=office.12).aspx

 




Tagged: