在 Xamarin.Android 中使用 Office 365 API

编程入门 行业动态 更新时间:2024-10-26 04:26:41
本文介绍了在 Xamarin.Android 中使用 Office 365 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在创建一个演讲示例:在 Xamarin.Android 中使用 Office 365,但我遇到了一些错误,不知道为什么:/

I am creating a sample for a talk: using Office 365 in Xamarin.Android, but I am having some errors, don´t know why :/

我明白了:

"System.InvalidOperationException: An error occurred while processing this request. --->        
    Microsoft.OData.Client.DataServiceTransportException: Error: NameResolutionFailure ---> 
    System.Net.WebException: Error: NameResolutionFailure\n  
    at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  at Microsoft.OData.Client.HttpWebRequestMessage.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  --- End of inner exception stack trace ---\n  
    at Microsoft.OData.Client.HttpWebRequestMessage.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  at Microsoft.OData.Client.ODataRequestMessageWrapper.EndGetResponse (IAsyncResult asyncResult) [0x00000]
    in <filename unknown>:0 \n  at Microsoft.OData.Client.DataServiceContext.GetResponseHelper (Microsoft.OData.Client.ODataRequestMessageWrapper request, IAsyncResult asyncResult, Boolean handleWebException) [0x00000] 
    in <filename unknown>:0 \n  --- End of inner exception stack trace ---\n  
    at Microsoft.OData.Client.BaseAsyncResult.EndExecute[QueryResult] (System.Object source, System.String method, IAsyncResult asyncResult) [0x00000]
    in <filename unknown>:0 \n  at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Contact] (System.Object source, System.String method, IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 \n 
    at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.Exchange.Extensions.IPagedEnumerable`1[Microsoft.Office365.Exchange.IContact]].GetResult () [0x00000] 
    in <filename unknown>:0 \n  at Microsoft.Office365.Exchange.Extensions.DataServiceContextWrapper+<ExecuteAsync>d__2d`2[Microsoft.Office365.Exchange.Contact,Microsoft.Office365.Exchange.IContact].MoveNext () [0x00000] 
    in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] 
    in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.Exchange.Extensions.IPagedEnumerable`1[Microsoft.Office365.Exchange.IContact]].GetResult () [0x00000] in <filename unknown>:0 \n  at Office365InXamarinApps.ViewModel.ContactsViewModel+<GetContacts>d__3.MoveNext () [0x000b5] in d:\\DevApps\\GitHub\\Office365InXamarinApps\\scr\\Office365InXamarinApps\\Office365InXamarinApps\\ViewModel\\ContactsViewModel.cs:44 \n--- End of stack trace from previous location where exception was thrown ---\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] 
    in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter`1[System.Collections.Generic.IEnumerable`1[Microsoft.Office365.Exchange.IContact]].GetResult () [0x00000]
    in <filename unknown>:0 \n  at Office365InXamarinApps.ViewModel.ContactsViewModel+<LoadData>d__0.MoveNext () [0x00030] 
    in d:\\DevApps\\GitHub\\Office365InXamarinApps\\scr\\Office365InXamarinApps\\Office365InXamarinApps\\ViewModel\\ContactsViewModel.cs:25 "   string

还有这个

"Microsoft.OData.Core.ODataErrorException: Object reference not set to an instance of an object.
    ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. 
    ---> Microsoft.OData.Client.DataServiceClientException: {\"error\":{\"code\":\"ErrorInternalServerError\",\"message\":\"Object reference not set to an instance of an object.\",\"innererror\":{\"message\":\"Object reference not set to an instance of an object.\",\"type\":\"System.NullReferenceException\",\"stacktrace\":\"  
    at Microsoft.Exchange.Services.OData.Model.ContactSchema.<tor>b__2c(Entity e, PropertyDefinition ep, ServiceObject s, PropertyInformation sp)\\r\\n   
    at Microsoft.Exchange.Services.OData.Model.SimpleEwsPropertyProvider.GetProperty(Entity entity, PropertyDefinition property, ServiceObject ewsObject)\\r\\n   
    at Microsoft.Exchange.Services.OData.Model.ContactProvider.ItemTypeToEntity(ItemType itemType, IList`1 properties)\\r\\n   
    at Microsoft.Exchange.Services.OData.Model.ContactProvider.Find(String parentFolderId, ContactQueryAdapter queryAdapter)\\r\\n   
    at Microsoft.Exchange.Services.OData.Model.FindContactsCommand.InternalExecute()\\r\\n   
    at Microsoft.Exchange.Services.OData.ODataCommand`2.Execute()\\r\\n  
    at Microsoft.Exchange.Services.OData.ODataTask.Execute(TimeSpan queueAndDelayTime, TimeSpan totalTime)\"}}}\n  
    at Microsoft.OData.Client.BaseAsyncResult.EndExecute[QueryResult] (System.Object source, System.String method, IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Contact] (System.Object source, System.String method, IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  --- End of inner exception stack trace ---\n  
    at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Contact] (System.Object source, System.String method, IAsyncResult asyncResult) [0x00000] 
    in <filename unknown>:0 \n  at Microsoft.OData.Client.DataServiceRequest.EndExecute[Contact] (System.Object source, Microsoft.OData.Client.DataServiceContext context, System.String method, IAsyncResult asyncResult) [0x00000]
    in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.Exchange.Extensions.IPagedEnumerable`1[Microsoft.Office365.Exchange.IContact]].GetResult () [0x00000] in <filename unknown>:0 \n  
    at Microsoft.Office365.Exchange.Extensions.DataServiceContextWrapper+<ExecuteAsync>d__2d`2[Microsoft.Office365.Exchange.Contact,Microsoft.Office365.Exchange.IContact].MoveNext () [0x00000] in <filename unknown>:0 \n  --- End of inner exception stack trace ---\n  
    at Microsoft.Office365.Exchange.Extensions.DataServiceContextWrapper+<ExecuteAsync>d__2d`2[Microsoft.Office365.Exchange.Contact,Microsoft.Office365.Exchange.IContact].MoveNext () [0x00000] 
    in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.Exchange.Extensions.IPagedEnumerable`1[Microsoft.Office365.Exchange.IContact]].GetResult () [0x00000] in <filename unknown>:0 \n  
    at Office365InXamarinApps.ViewModel.ContactsViewModel+<GetContacts>d__4.MoveNext () [0x000d7] in d:\\DevApps\\GitHub\\Office365InXamarinApps\\scr\\Office365InXamarinApps\\Office365InXamarinApps\\ViewModel\\ContactsViewModel.cs:53 " string

代码在这里:https://github/saramgsilva/Office365InXamarinApp

推荐答案

Office 365 API Preview 有问题,我无法使用它,因此我使用 Office 365 REST API 创建了另一个演示.

The Office 365 API Preview has issues and I cannot use it, for this reason I created another demo using Office 365 REST API.

https://github/saramgsilva/Office365RESTAPISample

这篇关于在 Xamarin.Android 中使用 Office 365 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 06:50:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/932796.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Android   Xamarin   Office   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!