Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

New to WSS and need a little guidance

  Asked By: Tarang    Date: Feb 08    Category: Sharepoint    Views: 775

The project I am working on seems pretty straightforward:
I need to send a query to a SP server that retrieves some project
data that is maintained there. I want to collect this data and create
some reports using an external application. I am attempting to use
WSS to do this.

So far I have managed to accomplish the following:
I can ask the server for a list collection, parse the list it returns
and read the various attributes. So I know I am talking to the server
and it is responding.

The problem I am having is that as soon as I try to submit a query
for list items, the server throws an exception. I have been over and
over the code and I cannot figure out what is wrong. I am brand new
to this though so it may be something quite obvious – just something
I haven't yet learned.

I am trying to submit a query that will return the "Title" for every
record where the "Status" field equals "Active". Here is the C# code.
If anyone could even give me a hint I would appreciate it
(unfortunately wrapping is probably going to make this difficult to
MyListSvc.Lists listService = new MyListSvc.Lists();
listService.Credentials =
listService.Url = "http://sharepnt/mygroup/_vti_bin/Lists.asmx";
XmlDocument xmlDoc = new XmlDocument();
string listName = "My Dashboard";
string viewName = "{700A900F-D7AA-4CD2-A97C-57B0D7A65232}";
string rowLimit = "150";
XmlElement query = xmlDoc.CreateElement("Query");
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
query.InnerXml = "<Where><Eq><FieldRef Name=\"Status\" /><Value
viewFields.InnerXml = "<FieldRef Name=\"Title\" />";
queryOptions.InnerXml = "";

XmlNode nodeListItems;
nodeListItems = null;

nodeListItems = listService.GetListItems(listName, viewName, query,
viewFields, rowLimit, queryOptions, null);
The error occurs when it gets to the last line – when it is actually
sending the query to the server.

I suspect it is something rudimentary that I am missing because of my
lack of experience but I cannot find any documentation that helps. I
have spent hours searching MSDN and looking at various places on web.



6 Answers Found

Answer #1    Answered By: Chandrabhan Agarkar     Answered On: Feb 08

A few questions:

1) What is the exception  message?

2) Have you checked the Windows event logs for any relevant errors?

3) Have you checked the SharePoint logs? This can be a bit more daunting,
but you'll find them in what we call the "12 hive", usually at
c:\Program Files\Common Files\Microsoft Shared\web server  extensions\12 (in
the Logs folder). There's a lot there, but if you can isolate the time that
the exception happens, you can at least look for anything marked "Error" in
the general vicinity.

Answer #2    Answered By: Lonnie Cohen     Answered On: Feb 08

Something else you can try is getting a copy of tcpmon and creating a local
proxy to the sp web service. this way you can see the actual message as it's
sent on the wire. More often than not, error messages are much clearer in
the raw.

Answer #3    Answered By: Ruchir Satam     Answered On: Feb 08

I am beginning to suspect that this may be the case. I checked all
the logs - no help. This is the error string  I get on the client end:

"Exception of
type 'Microsoft.SharePoint.SoapServer.SoapServerException' was

While I was trying a different approach I got a slightly more
detailed message that indicated there is a syntax error in the query
string beng submitted to the server. Interstingly enough, I stumbled
onto a two year old blog posting regarding someone who was getting
the same error and eventually came to the conclusion that the syntax
of the query, as demonstrated in the documentation (which is where I
got mine), was not correct. Since I am so new to this, I do not
really have any idea on how to change the query. I tried various
permutations of what was presented in the blog but they did not work

Answer #4    Answered By: Suresh Chindarkar     Answered On: Feb 08

I think you need to find some method that passes credentials  to
SharePoint as we are querying the list. This is because SharePoint
requires you to log in before you can access a list. Therefore, the
code needs to mimic the credentials active  directory passes and which
users rely on when navigating the intranet. I hope that's enough of
a hint.

Answer #5    Answered By: Varun Mehta     Answered On: Feb 08

Note the second and third line in my code  snippet below. That should
be taking care of the credential passing.

During one of my many attempts at taking a diferent approach to
solving this issue I got a slightly more detailed error message that
leads me to believe that there is a syntax error in the query  string.
Once again though, I do not see anything wrong  with it based on what
read  in the docs.

Thanks for the suggestions. I will let you know if I get this solved.
Atually I am just happy to know that I am not the only person who is
having an issue with this...

Answer #6    Answered By: Junior Jarvis     Answered On: Feb 08

Wanted to let you know that I finally managed  to successfully query
my SP server. It turns out that (despite some examples I found) you
must us the list  GUID and the view GUID to identify the list and view
you are querying. I was using a string  (the list name) for the name
parameter (not the GUID).

There are a few hoops to jump though to get the list and view GUIDS
but they are not too bad and only took me a couple minutes to figure

Not sure if this will help you with your issue or not but thought I
would pass it on.

Didn't find what you were looking for? Find more on New to WSS and need a little guidance Or get search suggestion and latest updates.