{"id":427,"date":"2011-03-01T21:24:55","date_gmt":"2011-03-01T21:24:55","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=427"},"modified":"2011-03-01T21:24:55","modified_gmt":"2011-03-01T21:24:55","slug":"updating-sharepoint-list-from-crm-plugin","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=427","title":{"rendered":"Updating Sharepoint List from CRM Plugin"},"content":{"rendered":"<p>I got requirement to integrate CRM with sharepoint, where I need to update sharepoint list fields from crm opportunity fields. In order to send opportunity information to sharepoint I wrote a plugin and used sharepoint Lists.asmx and sitedata.asmx webservice to update sharepoint list. I use below code to update sharepoint list<\/p>\n<p>\/\/create list object<br \/>\nSharepointWS.Lists OpportunityList = new SharepointWS.Lists();<br \/>\nOpportunityList.Credentials = new System.Net.NetworkCredential(&#8220;User&#8221;, &#8220;Password&#8221;, &#8220;Domain&#8221;);<\/p>\n<p>OpportunityList.Url = &#8220;http:\/\/tim\/news\/adsales\/groups\/domestic\/_vti_bin\/Lists.asmx&#8221;;<\/p>\n<p>\/\/Get list ID<br \/>\nXmlNode _List = OpportunityList.GetList(&#8220;List Name&#8221;);<br \/>\nstring _ListID = _List.Attributes[&#8220;ID&#8221;].Value;<\/p>\n<p>XmlDocument _Batchdoc = new XmlDocument();<br \/>\nXmlElement _BatchElement = _Batchdoc.CreateElement(&#8220;Batch&#8221;);<br \/>\n_BatchElement.SetAttribute(&#8220;OnError&#8221;, &#8220;Return&#8221;);<br \/>\n_BatchElement.SetAttribute(&#8220;ListVersion&#8221;, &#8220;1&#8221;);<br \/>\nstring UpdateCmd = &#8220;&#8221; +<br \/>\n&#8220;&#8221; + _SharepointViewID + &#8220;&#8221;+<br \/>\n&#8220;&#8221; + _AccountName + &#8220;&#8221;+<br \/>\n&#8220;&#8221; + _OpportunityType + &#8220;&#8221; +<br \/>\n&#8220;&#8221; + _OpportunityStatus + &#8220;&#8221;;<\/p>\n<p>XmlDocument _UpdateCmdDoc = new XmlDocument();<br \/>\n_UpdateCmdDoc.LoadXml(UpdateCmd);<br \/>\n_BatchElement.InnerXml = _UpdateCmdDoc.OuterXml;<br \/>\nXmlNode _Result;<br \/>\n_Result = OpportunityList.UpdateListItems(_ListID, _BatchElement);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got requirement to integrate CRM with sharepoint, where I need to update sharepoint list fields from crm opportunity fields. In order to send opportunity information to sharepoint I wrote a plugin and used sharepoint Lists.asmx and sitedata.asmx webservice to update sharepoint list. I use below code to update sharepoint list \/\/create list object SharepointWS.Lists OpportunityList = new SharepointWS.Lists(); OpportunityList.Credentials&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=427\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/427"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=427"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/427\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}