This project is being archived and replaced with the Microsoft Graph SDK for ObjC. As part of the archival process, we're closing all open issues and pull requests. See #37 for more context.
You can continue to use this library "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.
For complete samples, on how to integrate and use the SDK, please visit connect samples for swift and objective-c.
- Install Cocoapods - Follow the getting started guide to install Cocoapods.
- Add the following to your Podfile : `pod 'MSGraphSDK', '~> 0.10' - Make sure the podfile specifies the target. For more details, please refer to the complete samples mentioned above.
- Run the command
pod install
to install the latest MSGraphSDK pod. - Add
#import <MSGraphSDK/MSGraphSDK.h>
to all files that need to reference the SDK.
Register your application by following these steps.
-
To make requests, a MSAuthenticationProvider must be provided which is capable of authenticating HTTPS requests with an appropriate OAuth 2.0 bearer token.
-
This can be set by calling the class method
[MSGraphClient setAuthenticationProvider:myAuthProvider];
-
See msgraph-sdk-ios-nxoauth2-adapter for a sample implementation of MSAuthenticationProvider that can be used to jump-start your project.
- Once you have set the authentication provider, you must get an MSGraphClient object to make requests against the service:
self.client = [MSGraphClient client];
- It is often practical to perform this step only upon successful completion of any UI login flow required by the specified authentication provider.
Once you have an MSGraphClient that is authenticated you can begin to make calls against the service. The requests against the service look like our REST API.
For example, to retrieve a user's OneDrive:
[[[[graphClient me] drive] request] getWithCompletion:^(MSGraphDrive *drive, NSError *error){
//Returns an MSGraphDrive object or an error if there was one
}];
To get a user's root folder of their drive:
[[[[[graphClient me] drive] items:@"root"] request] getWithCompletion:^(MSGraphDriveItem *item, NSError *error){
//Returns an MSGraphDriveItem object or an error if there was one
}];
For a more detailed documentation see:
For known issues, see issues.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.