1
votes

Arrggh. I've seen like 15 examples that say do it like this: SharePoint web services: test if file exists

I'm on the same machine as the SP site, running as the SP and machine admin, I can happily call GetList, GetListCollection and GetWeb on the SiteData web service, but every time I call GetListItems on the Lists web service I get a "Value cannot be null.\nParameter name: g" error.

Nothing in the event viewer. Nothing in the sharepoint log files that relates Does anyone know a cause/fix/ where to look?

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

    ndQuery.InnerXml = "<OrderBy><FieldRef Name=\"ID\" /></OrderBy>";


    ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns><IncludeAttachmentUrls>FALSE</IncludeAttachmentUrls><Paging />";

    svc.GetListItems(list.ListName, null, ndQuery, ndViewFields, "5", ndQueryOptions, list.WebID.ToString());
2
Some additional insanity in case it helps. GetListCollection() returns "0" instead of a <Lists xmlns="schemas.microsoft.com/sharepoint/soap"> XML nodeRoger Willcocks

2 Answers

1
votes

You need to pass string.empty as the second paramter (view name) rather than a null value.

0
votes

I've tried your exact same code and it's worked perfectly for me. Also from your comment about GetListCollection() there is something environmental going wrong.

Have you checked over how you are connecting to the service? Perhaps tried it in its own console application?

If you can post the code relating to the service connection that might help further. Also is there anything unusual about how the web application has been set up (e.g. alternate access mappings).