I'm very new to Sharepoint, I have an aspx page on a Sharepoint site that shows a list of fields, including First Name, Last Name, etc. I'm have a console app, in Visual Studio, I'm using for testing communication and data transfer capability between between one web service and another; namely Sharepoint and another web service. My goal is to populate the various fields in the list on my Sharepoint site with data from the other web service. I'm using a web reference to the Lists Web Service on my Sharepoint server to try and gain access to fields in this particular list on the Sharepoint site. I have the following code:
''Name of my web reference to Lists Web Service is "sharepoint"
Dim sharepointList As New sharepoint.Lists()
sharepointList.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim testLists As XmlNode = sharepointList.GetListCollection
Dim xmlText As String = testLists.InnerXml
Dim xmlElement As XmlAttributeCollection = testLists.Attributes
I've been trying to find where this particular list is. I'll admit I'm not sure where I'm supposed to be looking, as the above code demonstrates. I've been using the debugger to analyze each of the above variables to try and find where in the开发者_如何学运维 XML this particular list is defined. Any help or insight is appreciated.
Here is a snapshot of the Sharepoint page containing the list I'm trying to search for:
UPDATE:
I decided to use the GetList() function and passed the name "New Hires" to it. It ended up grabbing the list above. Now I'm just trying to see if I can get access to just the fields pictured above, analyzing the xml it seems like those are just display names, the actual fieldID is some alpha numeric string, i.e. Display Name = "Business Phone" has the Field ID = "{fd630629-c165-4513-b43c-fdb16b86a14d}". I'm wondering if there's a way to search fields by Display Name.
Walkthrough with pictures
http://www.c-sharpcorner.com/UploadFile/mahesh/WSSInNet01302007093018AM/WSSInNet.aspx
Get a little more indepth with Talk to SharePoint Through its Web Services
To add records to the list you will need the (MSDN) Lists web service such as in this example or this one which also covers how to find the GUID of a list.
It's a two-pronged approach.
First, you need to access the SharePoint service from the context of the particular site that your list resides in. For example, if the URL to your list was:
http://sharepoint/foo/bar/baz/Lists/MyList
You would access the List Web Service from: http://sharepoint/foo/bar/baz/_vti_bin/lists.asmx
Now you're in the correct site collection. The remaining step would be to specify the list via name or GUID when you call one of the List methods. For example, if you were calling the UpdateListItems
method (and it sounds like you will be), you'd use:
sharepoint.UpdateListItems( "{B1DC8A9C-2316-41AD-875B-01C9D4BD19F8}", myUpdateXml );
or
sharepoint.UpdateListItems( "MyList", myUpdateXml );
Obviously, list name will correspond to the actual list name you see in the list's URL. The GUID can be found by viewing the list in SharePoint, then navigating to Settings > List Settings and grabbing it from the URL (look for the List
querystring parameter). It will be encoded, but you can use a utility like URL Decoder/Encoder to decode it to a proper GUID. Be sure to remember to use the {} brackets when sending in the GUID as a parameter.
精彩评论