Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Course Agenda
Office Camp
Module 1: Introduction to the Day
Module 2: Setting up the Environments
Module 3: Hooking into A...
http://developer.android.com/sdk/index.html
Android Client
Azure AD O365 SharePoint
Linked
JSON/REST
OAuth
Android Client
Azure AD O365 SharePoint
Linked
JSON/REST
OAuth
https://github.com/AzureAD/azure-activedirectory-
library-for-android
dependencies {
//Include the Active Directory Authentication Library
compile group: 'com.microsoft.aad', name: 'adal', ver...
<uses-permission android:name="android.permission.INTERNET" />
<application ...>
...
<activity
android:name="com.microsoft...
//in Activity
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(reque...
mAuthContext.acquireToken(currentActivity,
sharepointUrl, //e.g. http://mydomain.sharepoint.com
clientId, //an Azure AD cl...
mAuthContext.acquireTokenSilently(
resource,
clientId,
userId, //acquired by call to acquireToken
callback
);
Start
Show splash screen
acquireToken()AuthenticationActivity
Show main screen
End
storeTokens() callback(accessToken)
Start
User initiates API call
acquireTokenSilently()
callback(accessToken)
Complete API call
End
Cache valid? NO
YES
refre...
Android Client
Azure AD O365 SharePoint
Linked
JSON/REST
OAuth
https://github.com/OfficeDev/Office-365-SDK-for-
Android
ListClient client = new ListClient(
sharePointUrl, //e.g. "http://mydomain.sharepoint.com/"
sharePointSitePath, //e.g. "/c...
final String listName = "My List";
//this produces the odata query: $filter=Title+eq+"My list"
Query query = QueryOperatio...
final String listName = "My List";
//this produces the odata query: $filter=startsWith(Title,"Item #")
Query query = Query...
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Hooking SharePoint APIs with Android
Upcoming SlideShare
Loading in …5
×

Hooking SharePoint APIs with Android

1,767 views

Published on

Hooking SharePoint APIs with Android, Azure & Office 365

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Hooking SharePoint APIs with Android

  1. 1. Course Agenda Office Camp Module 1: Introduction to the Day Module 2: Setting up the Environments Module 3: Hooking into Apps for SharePoint Module 4: Hooking into Office 365 APIs Module 5: Hooking into Apps for Office Module 6: Hooking into SharePoint APIs with Android
  2. 2. http://developer.android.com/sdk/index.html
  3. 3. Android Client Azure AD O365 SharePoint Linked JSON/REST OAuth
  4. 4. Android Client Azure AD O365 SharePoint Linked JSON/REST OAuth
  5. 5. https://github.com/AzureAD/azure-activedirectory- library-for-android
  6. 6. dependencies { //Include the Active Directory Authentication Library compile group: 'com.microsoft.aad', name: 'adal', version: '1.0.5' }
  7. 7. <uses-permission android:name="android.permission.INTERNET" /> <application ...> ... <activity android:name="com.microsoft.aad.adal.AuthenticationActivity" android:label="Authenticate with AD" android:screenOrientation="portrait"> </activity> </application>
  8. 8. //in Activity protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //complete any authentication requests mContext.onActivityResult(requestCode, resultCode, data); } //in Activity.onCreate() mContext = new AuthenticationContext(application, authority, false);
  9. 9. mAuthContext.acquireToken(currentActivity, sharepointUrl, //e.g. http://mydomain.sharepoint.com clientId, //an Azure AD client id redirectUrl, //e.g. "http://android/callback" (also configured with AD) loginHint, //e.g. "user@mydomain.onmicrosoft.com" promptBehaviour, extraQueryArgs, callback //e.g. new AuthenticationCallback<AuthenticationResult>() {...} );
  10. 10. mAuthContext.acquireTokenSilently( resource, clientId, userId, //acquired by call to acquireToken callback );
  11. 11. Start Show splash screen acquireToken()AuthenticationActivity Show main screen End storeTokens() callback(accessToken)
  12. 12. Start User initiates API call acquireTokenSilently() callback(accessToken) Complete API call End Cache valid? NO YES refreshToken() Success?YES NO Restart app for auth End storeTokens()
  13. 13. Android Client Azure AD O365 SharePoint Linked JSON/REST OAuth
  14. 14. https://github.com/OfficeDev/Office-365-SDK-for- Android
  15. 15. ListClient client = new ListClient( sharePointUrl, //e.g. "http://mydomain.sharepoint.com/" sharePointSitePath, //e.g. "/client/site" credentials ); Credentials credentials = new OAuthCredentials(accessToken);
  16. 16. final String listName = "My List"; //this produces the odata query: $filter=Title+eq+"My list" Query query = QueryOperations.field("Title").eq(listName); //we can attach callbacks to f which will run when the data is available ListenableFuture<List<SPList>> f = client.getLists(query); //Or... calling .get() will block this thread until the data is available //DO NOT DO THIS ON THE UI THREAD! List<SPList> results = f.get();
  17. 17. final String listName = "My List"; //this produces the odata query: $filter=startsWith(Title,"Item #") Query query = QueryOperations.startsWith("Title", "Item #"); //we can attach callbacks to f which will run when the data is available ListenableFuture<List<SPListItem>> f = client.getListItems(listName, query); //Or... calling .get() will block this thread until the data is available //DO NOT DO THIS ON THE UI THREAD! List<SPListItem> results = f.get();

×