Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneDrive Search throws UnknownError when search contains "*" #161

Closed
TheUniquePaulSmith opened this issue Jul 11, 2017 · 2 comments
Closed

Comments

@TheUniquePaulSmith
Copy link

TheUniquePaulSmith commented Jul 11, 2017

Edit - Just realized I can also reproduce this in the Graph Explorer
I'm working on a prototype application leveraging the Microsoft.Graph SDK. I noticed that if I run the following code on my "Live" / Personal OneDrive account it works just fine and returns the files I expect. However, if I run the same code against my OneDrive for Business, it throws an internal exception within Microsoft.Graph.Core. I suspect the reason is that my search Url contains a * as mentioned in the error, but why does it work when searching a Live account and break when searching a Work account?

Sample Code Snippet:

 var graphserviceClient = new GraphServiceClient(
         new DelegateAuthenticationProvider(
             (requestMessage) =>
             {
                 requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", ADALAuth.CurrentAccessToken);

                 return Task.FromResult(0);
             }));

            var drive = graphserviceClient.Me.Drive.Request().GetAsync().Result;
            var collection = graphserviceClient.Me.Drive.Search("*.xyz").Request().GetAsync().GetAwaiter().GetResult();

The error message returned is:

Code: UnknownError
Message: A potentially dangerous Request.Path value was detected from the client (*).

Inner error

Stack Trace:

   at Microsoft.Graph.HttpProvider.<SendAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendAsync>d__32`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.DriveSearchRequest.<GetAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at _Default.Page_Load(Object sender, EventArgs e) in e:\Profile\Documents\Visual Studio 2015\WebSites\AzureWebApp\Default.aspx.cs:line 33
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
@caitlinrussell
Copy link
Contributor

Since this is a service related issue and not specific to the SDK, could you open a question on StackOverflow tagged with [microsoftgraph] and [onedrive]?

There are different behaviors in One Drive Consumer (live) and One Drive for Business and someone from that team should be able to elucidate why that is in this case.

@MIchaelMainer
Copy link
Contributor

@rgregg Search with a '*' is handled differently on consumer vs. business. Causes an UnknownError for business accounts.

https://stackoverflow.com/questions/45044183/onedrive-search-throws-unknownerror-when-search-contains

@ghost ghost locked as resolved and limited conversation to collaborators Feb 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants