首页 新闻 会员 周边 捐助

Native method call failed

0
悬赏园豆:10 [已关闭问题]

Contact contact = new Contact();
OutlookSession outlook = new OutlookSession();

contact.mobilephone="1235262";
outlook.Contacts.Items.Add(contact);

我是从xml里解析各个值然后赋给联系人各个属性的,向联系人里插入某个联系人时出现如下错误:Native method call failed.
请问哪位前辈有什么解决方法吗?

问题补充: 黎老师您好: 我是从服务器上下载xml并解析后执行到这句outlook.Contacts.Items.Add(contact);时出现这个Native method call failed.错误,我之前也曾经成功添加,但一段时间后就不行了,不知道是什么原因,请您帮我看一下,小弟在此先谢谢了! private static void AnalyzeLoadContactXml()//通讯录下载 { byte[] review = new byte[1024 * 1024]; string s = ""; int index = 0; int errRead = 0; string url = "phonebook_get.php?userid=" + Int32.Parse(MeraldRegistry.UserID) + "&password=" + MeraldRegistry.PassWord + "&encoding=&"; Cursor.Current = Cursors.WaitCursor; errRead = WebServices.WebServicesReadXml(url, review); if (errRead == 0) { XmlDocument xml = new XmlDocument(); xml.LoadXml(MeraldUtil.ByteArrayToString(review)); int count = int.Parse(xml.SelectSingleNode(".//count").InnerText); for (int i = 1; i <= count; i++) { OutlookSession outlook = new OutlookSession(); Contact contact = new Contact(); s = xml.SelectSingleNode(".//pl" + i).InnerText; //index = s.IndexOf("|"); //contact.LastName = s.Substring(0, index); //s = s.Substring(index + 1); index = s.IndexOf("|"); contact.FirstName = s.Substring(0, index); //contact.FirstName = ""; s = s.Substring(index + 1); index = s.IndexOf("|"); contact.MobileTelephoneNumber = s.Substring(0, index); s = s.Substring(index + 1); index = s.IndexOf("|"); contact.RadioTelephoneNumber = s.Substring(0, index); //s = s.Substring(index + 1);
小农小农的主页 小农小农 | 初学一级 | 园豆:180
提问于:2009-02-02 13:00
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册