Accessing sharepoint url in infopath code - InfoPath Dev
in

InfoPath Dev

Accessing sharepoint url in infopath code

Last post 11-14-2010 06:12 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-11-2010 08:10 AM

    Accessing sharepoint url in infopath code

     Hi i am trying to post data to the sharepoint list using the following code but its not working i hope the problem is with the ServerInfo.SharePointSiteUrl.Do anyone have the idea about how the url is getting set???

    using (SPSite mySite = new SPSite(ServerInfo.SharePointSiteUrl.ToString()))
                //using (SPSite mySite = new SPSite("http://sps17/sites/IPtest/IPformtest/Lists/Project%20Initiation/"))
                {
                    using (SPWeb myWeb = mySite.OpenWeb())
                    {
                        SPList shippingList = myWeb.Lists["Project Initiation"];
                        myWeb.AllowUnsafeUpdates = true;

                        XPathNavigator item1 = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field1", NamespaceManager);
                        XPathNavigator item2 = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field2", NamespaceManager);
                        XPathNavigator item3 = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field3", NamespaceManager);
                        XPathNavigator item4 = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field4", NamespaceManager);

                        SPListItem shipItem = shippingList.AddItem();
                        shipItem["FirstName"] = item1.Value;
                        shipItem["LastName"] = item2.Value;
                        shipItem["CompanyName"] = item3.Value;
                        shipItem["Phone"] = item4.Value;
                        shipItem.Update();

                    }
                }

    plz help me its urgent

    Thankyou in advance

  • 11-14-2010 06:12 PM In reply to

    Re: Accessing sharepoint url in infopath code

    Hi Sukumarsb,

    We can't answer every specific code issue that is posted to this forum. Instead, our stance is to provide a general, code-free solution and that is qRules v2.3. qRules v2.3 has great support for mapping to lists and it even round trips and supports reconciling edits made on the SharePoint list when you reopen the XML form. qRules helps us defray the cost of this forum, and it's really cheap. A free trial is all you need to prototype your solution. We also provide discount for people who send us a 2-3 sentence testimonial. That makes it close to free. Given how much time it will save you, it's worth much more than that.

    If you want to pay for support to debug your code, we provide low-cost InfoPath 911 support options on Qdabra.com's web site. Just click on Support.

    Best of luck,

     

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.