I have created some lists on my Sharepoint. Next, I'm trying to get data from Sharepoint with Java :
...
ListsSoap listsSoap = new Lists().getListsSoap();
GetListCollectionResult getListCollectionResult = listsSoap.getListCollection();
System.out.println(getListCollectionResult.getContent().toString());
...
I have no problem for me authenticate but my result is always a empty list :
[[Lists: null]]
Any ideas ?
Thanks.
In fact, we have to get the dom response like this :
GetListCollectionResult getListCollectionResult = listSoap.getListCollection();
Object result = getListCollectionResult.getContent().get(0);
if(result != null && result instanceof ElementNSImpl)
{
Document document = ((ElementNSImpl)result).getOwnerDocument();
System.out.println(WebServiceUtils.xml(document));
}
xml is a method which returns the xml string representation of my dom. Finally, I can see my collection of lists :
<Lists xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<List AllowDeletion="True" AllowMultiResponses="False" ...
<List AllowDeletion="True" AllowMultiResponses="False" ...
...
Each List node represents a list in my Sharepoint. Now, simply browse nodes :
NodeList list = ((ElementNSImpl)result).getElementsByTagName("List");
...
I hope this will help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.