How to use the GetListItems
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
How to use the GetListItems

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Han de Monnink
Guest





Posted: Tue Jan 18, 2005 4:37 pm    Post subject: How to use the GetListItems Reply with quote

I'am trying to find the ID of an item in a documentlibrary, by making a
WebService call GetListItems on the Lists webservice entry.

The code Is identical to what is specified in the SDK the only thing I
changed is the query;

listService.Credentials=
System.Net.CredentialCache.DefaultCredentials;

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndQuery = xmlDoc.CreateNode
(XmlNodeType.Element,"Query","");
XmlNode ndViewFields = xmlDoc.CreateNode
(XmlNodeType.Element,"ViewFields","");
XmlNode ndQueryOptions = xmlDoc.CreateNode
(XmlNodeType.Element,"QueryOptions","");

ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>
FALSE</IncludeMandatoryColumns>" +
"<DateInUtc>TRUE</DateInUtc>";
ndViewFields.InnerXml = "<FieldRef Name='ID'/>
<FieldRef Name='Title' />";

ndQuery.InnerXml = "<Where><Eq><FieldRef
Name='Title'/>" +
"<Value type='Text'>testdoc</Value></Eq>" +
"</Where>";


try
{
XmlNode ndListItems = listService.GetListItems
("doclib2", null, ndQuery,

ndViewFields, null, ndQueryOptions);
//MessageBox.Show(ndListItems.OuterXml);
}

.................................

I'am trying to find the ID of the Item which is called 'testdoc' in a
document library called 'doclib2' but for some reason this always results
in an error, Can't find the reason for this ...

Any body any idea

Han
Back to top
Jim McCusker
Guest





Posted: Thu Jan 20, 2005 7:23 pm    Post subject: RE: How to use the GetListItems Reply with quote

I don't believe the ID can be queried this way. When you look at an SPItem
object you can reference the field data using SPItem[fieldName] but the ID
can only be returned by using SPItem.ID.

"Han de Monnink" wrote:

Quote:
I'am trying to find the ID of an item in a documentlibrary, by making a
WebService call GetListItems on the Lists webservice entry.

The code Is identical to what is specified in the SDK the only thing I
changed is the query;

listService.Credentials=
System.Net.CredentialCache.DefaultCredentials;

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndQuery = xmlDoc.CreateNode
(XmlNodeType.Element,"Query","");
XmlNode ndViewFields = xmlDoc.CreateNode
(XmlNodeType.Element,"ViewFields","");
XmlNode ndQueryOptions = xmlDoc.CreateNode
(XmlNodeType.Element,"QueryOptions","");

ndQueryOptions.InnerXml = "<IncludeMandatoryColumns
FALSE</IncludeMandatoryColumns>" +
"<DateInUtc>TRUE</DateInUtc>";
ndViewFields.InnerXml = "<FieldRef Name='ID'/
FieldRef Name='Title' />";

ndQuery.InnerXml = "<Where><Eq><FieldRef
Name='Title'/>" +
"<Value type='Text'>testdoc</Value></Eq>" +
"</Where>";


try
{
XmlNode ndListItems = listService.GetListItems
("doclib2", null, ndQuery,

ndViewFields, null, ndQueryOptions);
//MessageBox.Show(ndListItems.OuterXml);
}

.................................

I'am trying to find the ID of the Item which is called 'testdoc' in a
document library called 'doclib2' but for some reason this always results
in an error, Can't find the reason for this ...

Any body any idea

Han


Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB