0

I have a share-point addin need to create the xamarin application. So need access to all the share-point online rest API.

As per the Microsoft document we need to register app on Azure AD.

I don't want to register the app in Azure AD, I already have share point adding

I have Tried the MSAL and ADAL Library provide by Microsoft for accessing. To used them we need to register app on Azure AD.

here is the code which I have written to access direct share-point rest API.

private const string GetCalendarEventsUrl = "{tenant}/_api/web/lists/getbytitle('Project')/items?$top=4900";

public List<CalendarEvent> GetCalendarEvents()
        {
            var username = "{tenant}.onmicrosoft.com";
            var password = "{password}";
            var domain = "{domain}";
            var handler = new HttpClientHandler();
            handler.Credentials = new System.Net.NetworkCredential(username, password, domain);

            using (var client = new HttpClient(handler))
            {
                using (var request = new HttpRequestMessage(HttpMethod.Get, new Uri(GetCalendarEventsUrl)))
                {
                    request.Headers.Add("Accept", "application/json;odata.metadata=minimal");
                    using (var response = client.SendAsync(request).Result){
                        if (response.IsSuccessStatusCode) {
                              Console.WriteLine("response");
                        }
                    }
                }
            }

            throw new Exception("Could not get calendar events");
        }

Can I access the share-point online rest API directly?

Mithlesh
  • 1
  • 3

1 Answers1

0

You can't directly access the Sharepoint rest api from mobile.

Here are my findings:-

A - You need to create your own web-services which will authenticate with the Sharepoint online web apis and deploy it then you will have to connect to the newly created web-services with your mobile app to fetch and update the data. you can find the proper description from this link

https://www.codemag.com/Article/1411031/Mobile-Apps-for-SharePoint-and-Office-365-Part-1

B - Another way is that you can add a new app, create a new app and register into the Azure AD with your own custom logics for the interactions with Sharepoint online rest api you can find the proper description from this link

https://learn.microsoft.com/en-gb/azure/active-directory/develop/app-types

Let me know,if it helps

bhavya joshi
  • 1,096
  • 10
  • 20