Filter data from SharePoint List in Code - InfoPath Dev
in

InfoPath Dev

Filter data from SharePoint List in Code

Last post 08-05-2010 08:00 AM by Potemkine. 29 replies.
Page 2 of 2 (30 items) < Previous 1 2
Sort Posts: Previous Next
  • 08-03-2010 12:06 PM In reply to

    Re: Filter data from SharePoint List in Code

    I did not see the InnerXML. Here is what I see:

    • View Detail
      • Exception Snapshot
        • System.Web.Services.Protocols.SoapException
          • Actor
          • Data (expandable)
          • HelpLnk
          • InnerException
          • Lang
          • Message
          • Node
          • Role
          • Source
          • StackTrace
          • TargetSite (expandable)

    Details of the error appear as follows:

    System.Web.Services.Protocols.SoapException
    Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at PROC1.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)
       at SourceSelectionRoomReservation.FormCode.CTRL66_5_Clicked(Object sender, ClickedEventArgs e)
       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    I hope that had what you were looking for. Thanks!

  • 08-03-2010 12:26 PM In reply to

    Re: Filter data from SharePoint List in Code

    hi, in VB it's certainly different...

    can you create a test list on the root with one item, and add this in your code

     Lst1.Url =  "http://YourSite/_vti_bin/lists.asmx";

    I can have the same error, when I put a bad list name. I just want to check if you are on the good WEB.

  • 08-03-2010 12:42 PM In reply to

    Re: Filter data from SharePoint List in Code

    Can you please put a try catch on your code I take this from msdn:

    Try

        Dim ndListItems As XmlNode =
            listService.GetListItems("List_Name", Nothing, ndQuery, _
            ndViewFields, Nothing, ndQueryOptions, Nothing)

        MessageBox.Show(ndListItems.OuterXml)

        Catch ex As System.Web.Services.Protocols.SoapException

            MessageBox.Show("Message:" + ControlChars.Lf + ex.Message +
                ControlChars.Lf +
            "Detail:" + ControlChars.Lf + ex.Detail.InnerText +
                ControlChars.Lf +
            "StackTrace:" + ControlChars.Lf + ex.StackTrace)

    End Try


  • 08-04-2010 07:06 AM In reply to

    Re: Filter data from SharePoint List in Code

    I am unable to create a list on the root. However....

    I added the Try/Catch and was able to get the detail error you were interested in: "GUID should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)"

    I acquired  the GUID from the "Modify List Target Audience Settings" page and replaced "ProcTraining" with the GUID. When I did this, I got a different error: "The system cannot find the file specified".

    Assuming I got the GUID right, is there a way to iterate through the Lists in the Web Reference to see if what I am looking for is actually there?

     

    Thanks again!

    Pinback 

     

  • 08-04-2010 07:18 AM In reply to

    Re: Filter data from SharePoint List in Code

    Can you use Sharepoint manager to be sure of your Id?

    http://spm.codeplex.com/

    I try to do this in VB and I have this error when my list name is bad (forgot a space)

  • 08-04-2010 07:33 AM In reply to

    Re: Filter data from SharePoint List in Code

    I  think my controlled access would prevent me from using Sharepoint Manager. However, I went into Sharepoint Designer and viewed the list's aspx code. I was able to find the GUID I used embedded in the file.

    Makes me feel like I set the Web Reference up incorrectly?

     

  • 08-04-2010 07:55 AM In reply to

    Re: Filter data from SharePoint List in Code

    I don't think your web reference is bad, perhaps you don't have correct permission on the list.

    If you create a infopath datasource on this list is it working ?

    Can you test another account who is Admin of the site you can replace networkcache by:

    lists_ws.Credentials = new System.Net.NetworkCredential(_user, _password, _domain);

  • 08-04-2010 08:38 AM In reply to

    Re: Filter data from SharePoint List in Code

    I was able to create a secondary datasource as you suggested. It appears to be working fine.

    I believe our network setup would prevent us from replacing the networkcache as shown above. I tried the following in an effort to view what all the  web reference consists of:

                Dim ListCollectionNodeList As System.Xml.XmlNodeList
                Dim Lst1 As New PROC1.Lists
                Dim NdTest As System.Xml.XmlNode
                NdTest = Lst1.GetListCollection

    I got an error message "The request failed with HTTP status 401: Unauthorized"

  • 08-04-2010 10:35 AM In reply to

    Re: Filter data from SharePoint List in Code

    Hi Pinback for your last test can you put

     Lst1.Credentials = System.Net.CredentialCache.DefaultCredentials

    If the secondary data source is working, it's mean that your user permission is OK.

    When you use the ID of the list , you use a string like :

    CC27CF28-3B08-4AC9-9316-EF5A6715EBD2

    8 dashes-4 dashes-4dashes-4dashes-12dashes ?

  • 08-04-2010 12:09 PM In reply to

    Re: Filter data from SharePoint List in Code

    Hi Potemkine,

    The Credentials on Lst1 were set to default as you suggested. Same error.

    Here is the full text of the failing line with the GUID:

    Dim ndListItems As XmlNode = Lst1.GetListItems("{1DD2E1C3-DDE6-4A81-BC79-67382F33E43C}", Nothing, ndQuery, Nothing, "10000", ndQueryOptions, Nothing)

    I know you have worked really hard with me to get this going. I have an alternative though. I can extract the data from a Secondary Datasource, iterate through the Nodes and populate arrays. I can then manipulate the arrays to filter out the data I do not want. Pretty? No. I think it will work.

    Unless you had another idea to try, many many thanks for all of your assistance!!!

    Pinback

  • 08-04-2010 12:28 PM In reply to

    Re: Filter data from SharePoint List in Code

    Can you try whitout {}

    Dim ndListItems As XmlNode = Lst1.GetListItems("1DD2E1C3-DDE6-4A81-BC79-67382F33E43C", Nothing, ndQuery, Nothing, "10000", ndQueryOptions, Nothing)

  • 08-05-2010 06:41 AM In reply to

    Re: Filter data from SharePoint List in Code

    Same error unfortunately.

    One of my co-workers told me we are getting MOSS 2010 early next year which makes accessing the List data much easier. I'll keep my fingers crossed. :)

  • 08-05-2010 07:13 AM In reply to

    Re: Filter data from SharePoint List in Code

    Ok, it's really weird... I think you have to do your last idea extract the data from a Secondary Datasource, iterate through the Nodes and populate arrays. I can then manipulate the arrays to filter out the data I do not want. I think it's working

  • 08-05-2010 07:52 AM In reply to

    Re: Filter data from SharePoint List in Code

    Yeah, Potemkine, I think we will finally get it to work this way. Thanks so much for all the help!!!!

     

    Pinback

  • 08-05-2010 08:00 AM In reply to

    Re: Filter data from SharePoint List in Code

    Your're welcome.

Page 2 of 2 (30 items) < Previous 1 2
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.