├── Podfile ├── iOS-objectivec-snippets-sample.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── iOS-objectivec-snippets-sample.xcworkspace └── contents.xcworkspacedata ├── iOS-objectivec-snippets-sample ├── ConnectViewController.h ├── AppDelegate.h ├── AuthenticationConstants.h ├── main.m ├── DetailViewController.h ├── MasterViewController.h ├── SnippetInfo.h ├── SnippetInfo.m ├── Authentication.h ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Snippets.h ├── AuthenticationConstants.m ├── EmailBody.html ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Authentication.m ├── AppDelegate.m ├── ConnectViewController.m ├── DetailViewController.m ├── MasterViewController.m └── Snippets.m ├── ios-objectiveC-snippets-sample.yml ├── .gitignore ├── License.txt ├── README-Localized ├── README-zh-cn.md ├── README-zh-tw.md ├── README-ja-jp.md ├── README-pt-br.md ├── README-ru-ru.md ├── README-es-es.md ├── README-de-de.md └── README-fr-fr.md ├── README.MD └── CONTRIBUTING.md /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'iOS-objectivec-snippets-sample' do 5 | pod 'MSGraphSDK' 6 | pod 'MSGraphSDK-NXOAuth2Adapter' 7 | end 8 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/ConnectViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | 8 | @interface ConnectViewController : UIViewController 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | 8 | @interface AppDelegate : UIResponder 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/AuthenticationConstants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | 8 | 9 | @interface AuthenticationConstants : NSObject 10 | 11 | // Application Information 12 | extern NSString *const kClientId; 13 | extern NSString *const kScopes; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | #import "AppDelegate.h" 8 | 9 | int main(int argc, char * argv[]) { 10 | @autoreleasepool { 11 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/DetailViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | 8 | #import "Snippets.h" 9 | 10 | @interface DetailViewController : UIViewController 11 | 12 | @property(weak, nonatomic)Snippets *snippets; 13 | @property(weak, nonatomic)SnippetInfo *snippetInfo; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/MasterViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | #import "Authentication.h" 8 | 9 | @class DetailViewController; 10 | 11 | @interface MasterViewController : UITableViewController 12 | 13 | @property (strong, nonatomic) DetailViewController *detailViewController; 14 | @property (strong, nonatomic) NXOAuth2AuthenticationProvider *authProvider; 15 | 16 | 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/SnippetInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | 8 | @interface SnippetInfo : NSObject 9 | 10 | @property (readonly) NSString *name; 11 | @property (readonly) SEL action; 12 | @property (readonly) BOOL needAdminAccess; 13 | 14 | - (instancetype)initWithName: (NSString *)name 15 | needsAdmin: (BOOL)needAdminAccess 16 | action: (SEL)action; 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ios-objectiveC-snippets-sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: Microsoft Graph iOS Objective C Snippets Sample 4 | path: '' 5 | description: This sample shows how to use the Microsoft Graph SDK to send email, manage groups, and perform other activities with Office 365 data. 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Microsoft Graph 11 | azureDeploy: '' 12 | author: bmitchell287 13 | platforms: [] 14 | languages: 15 | - Objective-C 16 | extensions: 17 | products: 18 | - Office 365 19 | scenarios: [] 20 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/SnippetInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "SnippetInfo.h" 7 | 8 | @implementation SnippetInfo 9 | 10 | 11 | 12 | - (instancetype)initWithName: (NSString *)name 13 | needsAdmin: (BOOL)needAdminAccess 14 | action: (SEL)action { 15 | self = [super init]; 16 | if (self) { 17 | _name = [name copy]; 18 | _needAdminAccess = needAdminAccess; 19 | _action = action; 20 | } 21 | return self; 22 | 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Authentication.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | #import 8 | #import 9 | 10 | @class NXOAuth2AuthenticationProvider; 11 | 12 | @interface Authentication : NSObject 13 | 14 | -(NXOAuth2AuthenticationProvider *)authProvider; 15 | -(void) connectToGraphWithClientId:(NSString *)clientId 16 | scopes:(NSArray *)scopes 17 | completion:(void (^)(NSError *error))completion; 18 | -(void) disconnect; 19 | 20 | 21 | 22 | @end 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Snippets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | #import "SnippetInfo.h" 8 | #import "Authentication.h" 9 | 10 | @protocol SnippetsDelegate 11 | 12 | - (void)snippetSuccess:(NSString *)displayText; 13 | - (void)snippetFailure:(NSError *)error; 14 | 15 | @end 16 | 17 | 18 | @interface Snippets : NSObject 19 | 20 | @property (strong, nonatomic, readonly) NSArray *snippetGroups; 21 | @property (strong, nonatomic, readonly) NSArray *snippetGroupNames; 22 | @property (assign, nonatomic) id delegate; 23 | 24 | - (void)setGraphClientWithAuthProvider:(id)provider; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/AuthenticationConstants.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "AuthenticationConstants.h" 7 | 8 | @implementation AuthenticationConstants 9 | 10 | // You will set your application's clientId 11 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 12 | 13 | //Important: These scoped are configured for non-admin users of the tenant. There are specific snippets that require admin privilieges for 14 | //them to run properly, and they will be marked as so in the UI. To run these admin-only snippets you'll need to add these additional scopes: 15 | //"https://graph.microsoft.com/Directory.AccessAsUser.All", 16 | //"https://graph.microsoft.com/User.ReadWrite.All" 17 | 18 | NSString * const kScopes = @"https://graph.microsoft.com/User.Read, https://graph.microsoft.com/User.ReadWrite, https://graph.microsoft.com/User.ReadBasic.All, https://graph.microsoft.com/Mail.Send, https://graph.microsoft.com/Calendars.ReadWrite, https://graph.microsoft.com/Mail.ReadWrite,https://graph.microsoft.com/Files.ReadWrite"; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Xcode ### 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.xcuserstate 18 | 19 | 20 | ### Objective-C ### 21 | # Xcode 22 | # 23 | build/ 24 | *.pbxuser 25 | !default.pbxuser 26 | *.mode1v3 27 | !default.mode1v3 28 | *.mode2v3 29 | !default.mode2v3 30 | *.perspectivev3 31 | !default.perspectivev3 32 | xcuserdata 33 | *.xccheckout 34 | *.moved-aside 35 | DerivedData 36 | *.hmap 37 | *.ipa 38 | *.xcuserstate 39 | 40 | # CocoaPods 41 | # 42 | Pods/ 43 | *Podfile.lock 44 | 45 | ### OSX ### 46 | .DS_Store 47 | .AppleDouble 48 | .LSOverride 49 | 50 | # Icon must end with two \r 51 | Icon 52 | 53 | 54 | # Thumbnails 55 | ._* 56 | 57 | # Files that might appear in the root of a volume 58 | .DocumentRevisions-V100 59 | .fseventsd 60 | .Spotlight-V100 61 | .TemporaryItems 62 | .Trashes 63 | .VolumeIcon.icns 64 | 65 | # Directories potentially created on remote AFP share 66 | .AppleDB 67 | .AppleDesktop 68 | Network Trash Folder 69 | Temporary Items 70 | .apdisk 71 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | 4 | Copyright (c) 2016 Microsoft 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/EmailBody.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Congratulations!

5 |

You just sent this email from the Snippets Sample for iOS ObjectiveC Using the Microsoft Graph SDK. How cool is that? You are well on your way to incorporating Microsoft Graph services in your apps.

6 |

Give us feedback

7 |

We'd love to get your feedback about the project. You can send your questions and suggestions to us in the issues section of the repository. 8 |

For more details on what else you can do with the Microsoft Graph endpoint in your iOS app, start with the 9 | Microsoft Graph page.

10 |

Thanks, and happy coding!

11 |

Your Microsoft Graph Development team

12 |
13 | 14 | 15 | 19 | 23 | 24 |
16 | See on GitHub 17 | 18 | 20 | Suggest on UserVoice 21 | 22 |
25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Authentication.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "Authentication.h" 7 | #import "AuthenticationConstants.h" 8 | #import 9 | 10 | 11 | 12 | 13 | @implementation Authentication 14 | 15 | 16 | - (NXOAuth2AuthenticationProvider *)authProvider { 17 | return [NXOAuth2AuthenticationProvider sharedAuthProvider]; 18 | } 19 | 20 | -(void)connectToGraphWithClientId:(NSString *)clientId scopes:(NSArray *)scopes completion:(void (^)(NSError *))completion{ 21 | [NXOAuth2AuthenticationProvider setClientId:clientId 22 | scopes:scopes]; 23 | /** 24 | Obtains access token by performing login with UI, where viewController specifies the parent view controller. 25 | @param viewController The view controller to present the UI on. 26 | @param completionHandler The completion handler to be called when the authentication has completed. 27 | error should be non nil if there was no error, and should contain any error(s) that occurred. 28 | */ 29 | 30 | if ([[NXOAuth2AuthenticationProvider sharedAuthProvider] loginSilent]) { 31 | completion(nil); 32 | } 33 | else { 34 | 35 | [[NXOAuth2AuthenticationProvider sharedAuthProvider] loginWithViewController:nil completion:^(NSError *error) { 36 | if (!error) { 37 | 38 | NSLog(@"Authentication successful."); 39 | completion(nil); 40 | } 41 | else{ 42 | NSLog(@"Authentication failed - %@", error.localizedDescription); 43 | completion(error); 44 | 45 | } 46 | }]; 47 | 48 | } 49 | } 50 | 51 | /** 52 | Signs out the current AuthProvider, completely removing all tokens and cookies. 53 | @param completionHandler The completion handler to be called when sign out has completed. 54 | error should be non nil if there was no error, and should contain any error(s) that occurred. 55 | */ 56 | -(void) disconnect{ 57 | [self.authProvider logout]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | #import "AppDelegate.h" 6 | #import "DetailViewController.h" 7 | 8 | @interface AppDelegate () 9 | 10 | @end 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 16 | // Override point for customization after application launch. 17 | // UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; 18 | // UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; 19 | // navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; 20 | // splitViewController.delegate = self; 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application { 30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | - (void)applicationWillEnterForeground:(UIApplication *)application { 35 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 36 | } 37 | 38 | - (void)applicationDidBecomeActive:(UIApplication *)application { 39 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 40 | } 41 | 42 | - (void)applicationWillTerminate:(UIApplication *)application { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/ConnectViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "Authentication.h" 7 | #import "AuthenticationConstants.h" 8 | #import "ConnectViewController.h" 9 | #import "DetailViewController.h" 10 | #import "MasterViewController.h" 11 | #import 12 | 13 | 14 | @interface ConnectViewController() 15 | @property (strong, nonatomic) Authentication *authentication; 16 | @end 17 | 18 | @implementation ConnectViewController 19 | 20 | -(void)viewDidLoad { 21 | 22 | [super viewDidLoad]; 23 | _authentication = [[Authentication alloc]init]; 24 | } 25 | 26 | - (IBAction)connectTapped:(id)sender { 27 | 28 | NSArray *scopes = [kScopes componentsSeparatedByString:@","]; 29 | [self.authentication connectToGraphWithClientId:kClientId scopes:scopes completion:^(NSError *error) { 30 | if (!error) { 31 | 32 | [self performSegueWithIdentifier:@"showSplitView" sender:nil]; 33 | NSLog(@"Authentication successful."); 34 | 35 | } 36 | else{ 37 | NSLog(@"Authentication failed - %@", error.localizedDescription); 38 | 39 | }; 40 | }]; 41 | 42 | } 43 | 44 | - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 45 | // Get the new view controller using [segue destinationViewController]. 46 | // Pass the selected object to the new view controller. 47 | UISplitViewController *splitViewController = segue.destinationViewController; 48 | 49 | UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; 50 | navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; 51 | navigationController = (UINavigationController*)splitViewController.viewControllers.firstObject; 52 | MasterViewController *mc =(MasterViewController*)navigationController.topViewController; 53 | mc.authProvider = self.authentication.authProvider; 54 | splitViewController.delegate = self; 55 | 56 | 57 | 58 | } 59 | 60 | - (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController { 61 | if ([secondaryViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)secondaryViewController topViewController] isKindOfClass:[DetailViewController class]] && ([(DetailViewController *)[(UINavigationController *)secondaryViewController topViewController] snippets] == nil)) { 62 | // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. 63 | return YES; 64 | } else { 65 | return NO; 66 | } 67 | } 68 | 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/DetailViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "DetailViewController.h" 7 | 8 | 9 | @interface DetailViewController() 10 | @property (strong, nonatomic) IBOutlet UITextField *reponseTextField; 11 | @property (strong, nonatomic) IBOutlet UILabel *snippetNameLabel; 12 | @property (strong, nonatomic) IBOutlet UILabel *accessLevelLabel; 13 | @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicatorView; 14 | @property (strong, nonatomic) IBOutlet UIStackView *resultStackView; 15 | @property (strong, nonatomic) IBOutlet UILabel *result; 16 | 17 | @end 18 | 19 | @implementation DetailViewController 20 | 21 | 22 | #pragma mark - View controller lifecycle 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | [self configureView]; 27 | } 28 | 29 | 30 | - (void)didReceiveMemoryWarning { 31 | [super didReceiveMemoryWarning]; 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | 36 | -(void)viewWillAppear:(BOOL)animated{ 37 | [super viewWillAppear:animated]; 38 | } 39 | 40 | - (void)viewDidAppear:(BOOL)animated { 41 | [super viewDidAppear:animated]; 42 | 43 | // start executing snippet 44 | [self.activityIndicatorView startAnimating]; 45 | 46 | if (self.snippets && self.snippetInfo) { 47 | self.snippets.delegate = self; 48 | 49 | IMP imp = [self.snippets methodForSelector:self.snippetInfo.action]; 50 | void (*func)(id, SEL) = (void *)imp; 51 | func(self.snippets, self.snippetInfo.action); 52 | } 53 | 54 | } 55 | 56 | 57 | #pragma mark - Managing snippets and snippetinfo 58 | 59 | - (void)setSnippetInfo:(SnippetInfo *)newSnippetInfo { 60 | if (_snippetInfo != newSnippetInfo) { 61 | _snippetInfo = newSnippetInfo; 62 | } 63 | [self configureView]; 64 | } 65 | 66 | 67 | - (void)configureView { 68 | if (self.snippetInfo) { 69 | self.snippetNameLabel.text = self.snippetInfo.name; 70 | self.accessLevelLabel.hidden = !self.snippetInfo.needAdminAccess; 71 | } 72 | } 73 | 74 | #pragma mark - snippet delegate 75 | 76 | - (void)snippetSuccess:(NSString *)displayText { 77 | dispatch_async(dispatch_get_main_queue(), ^{ 78 | self.result.numberOfLines = 0; 79 | self.result.text = [NSString stringWithFormat:@"Success\n\n%@\n", displayText]; 80 | [self.resultStackView addArrangedSubview:self.result]; 81 | [self.activityIndicatorView stopAnimating]; 82 | self.activityIndicatorView.hidden = true; 83 | }); 84 | } 85 | 86 | 87 | - (void)snippetFailure:(NSError *)error { 88 | dispatch_async(dispatch_get_main_queue(), ^{ 89 | self.result.text = [NSString stringWithFormat:@"Failure\n\n%@\n%@",error.localizedDescription, error.userInfo]; 90 | 91 | [self.activityIndicatorView stopAnimating]; 92 | self.activityIndicatorView.hidden = true; 93 | }); 94 | } 95 | 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/MasterViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "Authentication.h" 7 | #import "AuthenticationConstants.h" 8 | #import "DetailViewController.h" 9 | #import "MasterViewController.h" 10 | #import "SnippetInfo.h" 11 | #import "Snippets.h" 12 | #import 13 | 14 | 15 | @interface MasterViewController () 16 | 17 | @property (strong, nonatomic)Snippets *snippets; 18 | @property (strong, nonatomic)SnippetInfo *snippetInfo; 19 | @end 20 | 21 | @implementation MasterViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view, typically from a nib. 26 | 27 | self.detailViewController = (DetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; 28 | self.snippets = [[Snippets alloc] init]; 29 | [self.snippets setGraphClientWithAuthProvider:(id)self.authProvider]; 30 | } 31 | 32 | 33 | 34 | - (void)viewWillAppear:(BOOL)animated { 35 | self.clearsSelectionOnViewWillAppear = self.splitViewController.isCollapsed; 36 | [super viewWillAppear:animated]; 37 | 38 | } 39 | 40 | - (void)didReceiveMemoryWarning { 41 | [super didReceiveMemoryWarning]; 42 | // Dispose of any resources that can be recreated. 43 | } 44 | 45 | - (IBAction)disconnectTapped:(id)sender { 46 | 47 | [self.authProvider logout]; 48 | [self.navigationController.splitViewController dismissViewControllerAnimated:true completion:nil]; 49 | } 50 | 51 | #pragma mark - Segues 52 | 53 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 54 | if ([[segue identifier] isEqualToString:@"showDetail"]) { 55 | NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 56 | DetailViewController *controller = (DetailViewController *)[[segue destinationViewController] topViewController]; 57 | 58 | controller.snippets = self.snippets; 59 | controller.snippetInfo = self.snippets.snippetGroups[indexPath.section][indexPath.row]; 60 | 61 | [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 62 | controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; 63 | controller.navigationItem.leftItemsSupplementBackButton = YES; 64 | } 65 | } 66 | 67 | #pragma mark - Table View 68 | 69 | -(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 70 | return self.snippets.snippetGroupNames[section]; 71 | } 72 | 73 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 74 | return self.snippets.snippetGroups.count; 75 | } 76 | 77 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 78 | return ((NSArray*)self.snippets.snippetGroups[section]).count; 79 | } 80 | 81 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 82 | 83 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 84 | 85 | SnippetInfo *snippet = self.snippets.snippetGroups[indexPath.section][indexPath.row]; 86 | cell.textLabel.text = snippet.name; 87 | 88 | if(snippet.needAdminAccess){ 89 | cell.detailTextLabel.text = @"Requires admin access"; 90 | } 91 | else { 92 | cell.detailTextLabel.text = @""; 93 | } 94 | 95 | return cell; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /README-Localized/README-zh-cn.md: -------------------------------------------------------------------------------- 1 | # Microsoft Graph iOS Objective C 代码段示例 2 | 3 | **目录** 4 | 5 | * [简介](#introduction) 6 | * [先决条件](#prerequisites) 7 | * [注册和配置应用](#register) 8 | * [启用钥匙链共享](#keychain) 9 | * [构建和调试](#build) 10 | * [运行示例](#run) 11 | * [示例如何影响租户数据](#how-the-sample-affects-your-tenant-data) 12 | * [问题和意见](#questions) 13 | * [其他资源](#additional-resources) 14 | 15 | 16 | ## 简介 17 | 18 | 该示例包含介绍如何使用 Microsoft Graph SDK 以发送电子邮件、管理组和使用 Office 365 数据执行其他活动的代码段存储库。它使用 [适用于 iOS 的 Microsoft Graph SDK](https://github.com/microsoftgraph/msgraph-sdk-ios) 以结合使用由 Microsoft Graph 返回的数据。 19 | 20 | 此存储库介绍如何通过在 iOS 应用中向 Microsoft Graph API 生成 HTTP 请求来访问多个资源,包括 Microsoft Azure Active Directory (AD) 和 Office 365 API。 21 | 22 | 此外,该示例使用 [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) 用于身份验证。若要生成请求,必须提供 **MSAuthenticationProvider**(它能够使用适当的 OAuth 2.0 持有者令牌对 HTTPS 请求进行身份验证)。我们将对 MSAuthenticationProvider 的示例实现使用此框架,以快速启动你的项目。 23 | 24 | > **注意**:**msgraph-sdk-ios-nxoauth2-adapter** 是该应用中进行身份验证的示例 OAuth 实现,用于演示目的。 25 | 26 | 这些代码段简单且是自包含的,你可以在任何合适的时间将其复制并粘贴到你自己的代码中,或将其作为学习如何使用适用于 iOS 的 Microsoft Graph SDK 的资源。有关此示例中使用的所有原始代码段的列表的引用,请参阅 wiki 中的 [示例操作列表](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List)。 27 | 28 | **注意:** 如果可能,请通过“非工作”或测试帐户使用该示例。该示例并非总能清理邮箱和日历中创建的对象。此时,需要手动删除示例邮件和日历事件。此外,请注意获取和发送邮件的代码段以及获取、创建、更新和删除事件的代码段在所有个人帐户中均不可用。只有在这些帐户更新至使用 Azure AD v2.0 终结点时,这些操作才可用。 29 | 30 | 31 | 32 | 33 | ## 先决条件 ## 34 | 35 | 此示例要求如下: 36 | * Apple 的 [XCode](https://developer.apple.com/xcode/downloads/) 37 | * 安装 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 作为依存关系管理器。 38 | * Microsoft 工作或个人电子邮件帐户,例如 Office 365 或 outlook.com、hotmail.com 等。你可以注册 [Office 365 开发人员订阅](https://aka.ms/devprogramsignup),其中包含开始构建 Office 365 应用所需的资源。 39 | * [Microsoft Graph 应用注册门户](https://graph.microsoft.io/en-us/app-registration) 中已注册应用的客户端 ID 40 | * 如上所述,若要生成身份验证请求,必须提供 **MSAuthenticationProvider**(它能够使用适当的 OAuth 2.0 持有者令牌对 HTTPS 请求进行身份验证)。 41 | 42 | 43 | 44 | 45 | ## 注册和配置应用 46 | 47 | 1. 使用个人或工作或学校帐户登录到 [应用注册门户](https://apps.dev.microsoft.com/)。 48 | 2. 选择“**添加应用**”。 49 | 3. 为应用输入名称,并选择“**创建应用程序**”。将显示注册页,其中列出应用的属性。 50 | 4. 在“**平台**”下,选择“**添加平台**”。 51 | 5. 选择“**移动应用程序**”。 52 | 6. 复制客户端 ID(应用 ID)以供后续使用。将需要在示例应用中输入该值。应用 ID 是应用的唯一标识符。 53 | 7. 选择“保存”****。 54 | 55 | 56 | ## 启用密钥链共享 57 | 58 | 对于 Xcode 8,将需要添加钥匙链组,否则应用程序将无法访问钥匙链。添加钥匙链组: 59 | 60 | 1. 在 Xcode 项目管理器面板上选择项目。(⌘ + 1)。 61 | 62 | 2. 选择 **iOS-objectivec-snippets-sample**。 63 | 64 | 3. 在“功能”选项卡上启用**钥匙链共享**。 65 | 66 | 4. 将 **com.microsoft.iOS-objectivec-snippets-sample** 添加到钥匙链组。 67 | 68 | 69 | ## 构建和调试 70 | 71 | 1. 克隆该存储库 72 | 2. 使用 CocoaPods 以导入 Microsoft Graph SDK 和身份验证依赖项: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | 该示例应用已包含可将 pod 导入到项目中的 pod 文件。只需从**终端**导航到项目并运行: 79 | 80 | pod install 81 | 82 | 有关更多详细信息,请参阅[其他资源](#AdditionalResources)中的**使用 CocoaPods** 83 | 84 | 3. 打开 **O365-iOS-Microsoft-Graph-SDK.xcworkspace** 85 | 4. 打开 **AuthenticationConstants.m**。你会发现,注册过程的 **ClientID** 可以被添加到文件顶部: 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > 注意:有关使用此示例所需的权限范围的详细信息,请参阅下一节的“**运行示例**”。 91 | 5. 运行示例。 92 | 93 | 94 | ## 运行示例 95 | 96 | 启动时,应用将显示表示常见用户任务的一系列框。这些任务可以基于帐户类型和权限级别运行: 97 | 98 | - 适用于工作或学校以及个人帐户的任务,如接收和发送电子邮件、创建文件等。 99 | - 仅适用于工作或学校帐户的任务,如获取用户的管理器或帐户照片。 100 | - 仅适用于具有管理权限的工作或学校帐户的任务,如获取组成员或新建用户帐户。 101 | 102 | 选择想要执行的任务并对其单击以运行。请注意,如果未使用对所选任务适用的权限的帐户进行登录,则会失败。例如,如果在组织中没有管理员特权的帐户中运行某个特定的代码段(如获取所有租户组),则该操作会失败。或者,如果使用个人帐户(如 hotmail.com)进行登录并尝试获取登录用户的管理器,则该操作会失败。 103 | 104 | 目前,该示例应用被配置为位于 Authentication\AuthenticationConstants.m 中的以下作用域: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | 只需使用上面定义的作用域即可执行多个操作。但是,某些任务需要管理员权限才能正常运行,且 UI 中的任务将被标记为需要管理员访问权限。管理员可以将以下作用域添加到 Authentication.constants.m 以运行这些代码段: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | 此外,若要查看哪类代码段可以在管理员、组织或个人帐户下运行,请参阅 Snippets Library/Snippets.m。每个代码段说明都将详述访问级别。 121 | 122 | 123 | ##示例如何影响你的租户数据 124 | 此示例运行创建、读取、更新或删除数据的命令。运行删除或编辑数据的命令时,示例创建测试实体。示例将在你的租户上留下其中这些实体。 125 | 126 | 127 | ## 参与 128 | 129 | 如果想要参与本示例,请参阅 [CONTRIBUTING.MD](/CONTRIBUTING.md)。 130 | 131 | 此项目采用 [Microsoft 开源行为准则](https://opensource.microsoft.com/codeofconduct/)。有关详细信息,请参阅 [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)(行为准则常见问题解答),有任何其他问题或意见,也可联系 [opencode@microsoft.com](mailto:opencode@microsoft.com)。 132 | 133 | 134 | ## 问题和意见 135 | 136 | 我们乐意倾听你有关 Microsoft Graph iOS Objective C 代码段示例项目的反馈。你可以在该存储库中的 [问题](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) 部分将问题和建议发送给我们。 137 | 138 | 我们非常重视你的反馈意见。请在 [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph) 上与我们联系。使用 [MicrosoftGraph] 标记出你的问题。 139 | 140 | 141 | ## 其他资源 142 | 143 | - [Microsoft Graph 概述](http://graph.microsoft.io) 144 | - [Office 开发人员代码示例](http://dev.office.com/code-samples) 145 | - [Office 开发人员中心](http://dev.office.com/) 146 | 147 | 148 | ## 版权 149 | 版权所有 (c) 2016 Microsoft。保留所有权利。 150 | -------------------------------------------------------------------------------- /README-Localized/README-zh-tw.md: -------------------------------------------------------------------------------- 1 | # Microsoft Graph iOS Objective C 程式碼片段範例 2 | 3 | **目錄** 4 | 5 | * [簡介](#introduction) 6 | * [必要條件](#prerequisites) 7 | * [註冊和設定應用程式](#register) 8 | * [啟用金鑰鏈共用](#keychain) 9 | * [建置及偵錯](#build) 10 | * [執行範例](#run) 11 | * [範例如何影響租用戶資料](#how-the-sample-affects-your-tenant-data) 12 | * [問題和建議](#questions) 13 | * [其他資源](#additional-resources) 14 | 15 | 16 | ## 簡介 17 | 18 | 這個範例包含程式碼片段的儲存機制,顯示如何使用 Microsoft Graph SDK 來傳送電子郵件、管理群組,以及執行其他使用 Office 365 資料的活動。它會使用 [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios),使用 Microsoft Graph 所傳回的資料。 19 | 20 | 這個儲存機制會示範如何存取多個資源,包括 Microsoft Azure Active Directory (AD) 和 Office 365 API,方法是在 iOS 應用程式中對 Microsoft Graph API 進行 HTTP 要求。 21 | 22 | 此外,範例使用 [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) 進行驗證。若要提出要求,必須提供 **MSAuthenticationProvider**,它能夠以適當的 OAuth 2.0 持有人權杖驗證 HTTPS 要求。我們會針對 MSAuthenticationProvider 的範例實作使用此架構,可以用來幫助您的專案。 23 | 24 | > **附註** **msgraph-sdk-ios-nxoauth2-adapter** 是這個應用程式中進行驗證的範例 OAuth 實作,且作為示範之用。 25 | 26 | 這些程式碼片段簡單且獨立,而且您可以在適當時,複製並貼到自己的程式碼,或使用它們做為資源來學習如何使用 Microsoft Graph SDK for iOS。如需這個範例中用來參考的所有原始程式碼片段的清單,請參閱 wiki 中的[範例作業清單](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List)。 27 | 28 | **附註︰** 如果可能的話,請以「非工作」或測試帳戶來使用這個範例。範例不會一律清除您的信箱和行事曆中建立的物件。目前,您必須手動移除範例郵件及行事曆事件。另請注意取得和傳送訊息的程式碼片段,以及取得、建立、更新和刪除事件的程式碼片段不適用於所有個人帳戶。當這些帳戶升級為使用 Azure AD v2.0 驗證端點時,這些作業最終可以運作。 29 | 30 | 31 | 32 | 33 | ## 必要條件 ## 34 | 35 | 此範例需要下列項目: 36 | * 來自 Apple 的 [XCode](https://developer.apple.com/xcode/downloads/) 37 | * 安裝 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 做為相依性管理員。 38 | * Microsoft 工作或個人電子郵件帳戶,例如 Office 365,或 outlook.com、hotmail.com 等等。您可以註冊 [Office 365 開發人員訂用帳戶](https://aka.ms/devprogramsignup),其中包含開始建置 Office 365 應用程式所需的資源。 39 | * 已註冊應用程式的用戶端識別碼,來自 [Microsoft Graph 應用程式註冊入口網站](https://graph.microsoft.io/en-us/app-registration) 40 | * 如前所述,若要提出驗證要求,必須提供 **MSAuthenticationProvider**,它能夠以適當的 OAuth 2.0 持有人權杖驗證 HTTPS 要求。 41 | 42 | 43 | 44 | 45 | ## 註冊和設定應用程式 46 | 47 | 1. 使用您的個人或工作或學校帳戶登入[應用程式註冊入口網站](https://apps.dev.microsoft.com/)。 48 | 2. 選取 [新增應用程式]****。 49 | 3. 為應用程式輸入名稱,然後選取 [建立應用程式]****。[註冊] 頁面隨即顯示,列出您的應用程式的屬性。 50 | 4. 在 [平台]**** 底下,選取 [新增平台]****。 51 | 5. 選取 [行動應用程式]****。 52 | 6. 複製用戶端識別碼 (應用程式識別碼),以供日後使用。您必須將此值輸入範例應用程式中。應用程式識別碼是您的應用程式的唯一識別碼。 53 | 7. 選取 [儲存]****。 54 | 55 | 56 | ## 啟用金鑰鏈共用 57 | 58 | 針對 Xcode 8,您將需要新增金鑰鏈群組,否則您的應用程式將無法存取金鑰鏈。若要新增金鑰鏈群組: 59 | 60 | 1. 在 Xcode 中的專案管理員面板上選取專案。(⌘ + 1。) 61 | 62 | 2. 選取 **iOS-objectivec-snippets-sample**。 63 | 64 | 3. 在 [功能] 索引標籤上,啟用 [金鑰鏈共用]****。 65 | 66 | 4. 新增 **com.microsoft.iOS-objectivec-snippets-sample** 到金鑰鏈群組。 67 | 68 | 69 | ## 建置和偵錯 70 | 71 | 1. 複製此儲存機制 72 | 2. 使用 CocoaPods 來匯入 Microsoft Graph SDK 和驗證相依性: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | 此範例應用程式已經包含可將 pods 放入專案的 podfile。只需從 **Terminal** 瀏覽至專案並執行: 79 | 80 | pod install 81 | 82 | 如需詳細資訊,請參閱[其他資訊](#AdditionalResources)中的**使用 CocoaPods** 83 | 84 | 3. 開啟 **O365-iOS-Microsoft-Graph-SDK.xcworkspace** 85 | 4. 開啟 **AuthenticationConstants.m**。您會發現註冊程序的 **ClientID** 可以新增至檔案頂端: 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > 附註:如需使用這個範例所需的權限範圍的詳細資訊,請參閱以下區段:**執行範例**。 91 | 5. 執行範例。 92 | 93 | 94 | ## 執行範例 95 | 96 | 啟動時,應用程式會顯示一系列方塊,代表一般使用者工作。這些工作可以根據帳戶類型和權限層級執行︰ 97 | 98 | - 適用於工作或學校和個人帳戶的工作,例如取得和傳送電子郵件、建立檔案等等。 99 | - 只適用於工作或學校帳戶的工作,例如取得使用者的經理或帳戶相片。 100 | - 只適用於具有管理權限的工作或學校帳戶的工作,例如取得群組成員,或建立新的使用者帳戶。 101 | 102 | 選取您想要執行的工作,並且按一下它以執行。請注意,如果您登入沒有工作的適用權限的帳戶,您選取的工作就會失敗。例如,如果嘗試從沒有組織中的系統管理權限的帳戶,執行特定程式碼片段,像是取得所有租用戶群組,則作業將會失敗。或者,如果您登入個人帳戶 (例如 hotmail.com) 並且嘗試取得已登入使用者的經理,則作業會失敗。 103 | 104 | 目前這個範例應用程式已設定為位於 Authentication\AuthenticationConstants.m 的下列範圍: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | 您可以只使用以上定義的範圍執行數個作業。不過,有些工作需要系統管理員權限才能正常執行,而且在 UI 中的工作會被標示為需要系統管理存取權。系統管理員可能會將下列範圍新增至 Authentication.constants.m 以執行這些程式碼片段︰ 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | 此外,若要查看可以針對管理、組織或個人帳戶執行哪些程式碼片段,請參閱 Snippets Library/Snippets.m。每個程式碼片段描述中將詳細說明存取的層級。 121 | 122 | 123 | ##範例如何影響租用戶資料 124 | 這個範例會執行命令,該命令會建立、讀取、更新或刪除資料。當執行刪除或編輯資料的命令時,範例會建立測試實體。這個範例會在您的租用戶上留下部分實體。 125 | 126 | 127 | ## 參與 128 | 129 | 如果您想要參與這個範例,請參閱 [CONTRIBUTING.MD](/CONTRIBUTING.md)。 130 | 131 | 此專案已採用 [Microsoft 開放原始碼執行](https://opensource.microsoft.com/codeofconduct/)。如需詳細資訊,請參閱[程式碼執行常見問題集](https://opensource.microsoft.com/codeofconduct/faq/),如果有其他問題或意見,請連絡 [opencode@microsoft.com](mailto:opencode@microsoft.com)。 132 | 133 | 134 | ## 問題和建議 135 | 136 | 我們很樂於收到您對於 Microsoft Graph iOS Objective C 程式碼片段範例專案的意見反應。您可以在此儲存機制的[問題](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues)區段中,將您的問題及建議傳送給我們。 137 | 138 | 我們很重視您的意見。請透過 [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph) 與我們連絡。以 [MicrosoftGraph] 標記您的問題。 139 | 140 | 141 | ## 其他資源 142 | 143 | - [Microsoft Graph 概觀](http://graph.microsoft.io) 144 | - [Office 開發人員程式碼範例](http://dev.office.com/code-samples) 145 | - [Office 開發人員中心](http://dev.office.com/) 146 | 147 | 148 | ## 著作權 149 | Copyright (c) 2016 Microsoft.著作權所有,並保留一切權利。 150 | -------------------------------------------------------------------------------- /README-Localized/README-ja-jp.md: -------------------------------------------------------------------------------- 1 | # Microsoft Graph iOS Objective C スニペットのサンプル 2 | 3 | **目次** 4 | 5 | * [はじめに](#introduction) 6 | * [前提条件](#prerequisites) 7 | * [アプリを登録して構成する](#register) 8 | * [キーチェーンの共有を有効にする](#keychain) 9 | * [ビルドとデバッグ](#build) 10 | * [サンプルの実行](#run) 11 | * [サンプルによるテナント データへの影響](#how-the-sample-affects-your-tenant-data) 12 | * [質問とコメント](#questions) 13 | * [その他のリソース](#additional-resources) 14 | 15 | 16 | ## はじめに 17 | 18 | このサンプルには、メールの送信、グループの管理、および Office 365 データを使用した他のアクティビティの実行に Microsoft Graph SDK を使用する方法を示すコード スニペットのリポジトリが含まれています。[Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) を使用して、Microsoft Graph が返すデータを操作します。 19 | 20 | このリポジトリでは、iOS アプリで Microsoft Graph API への HTTP 要求を実行して、Microsoft Azure Active Directory (AD) と Office 365 API などの複数のリソースにアクセスする方法を示します。 21 | 22 | また、サンプルでは認証に [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) を使用します。要求を実行するには、適切な OAuth 2.0 ベアラー トークンを使用して HTTPS 要求を認証できる **MSAuthenticationProvider** を指定する必要があります。プロジェクトのジャンプ スタート用に使用できる MSAuthenticationProvider をサンプル実装するために、このフレームワークを使用します。 23 | 24 | > **注** **msgraph-sdk-ios-nxoauth2-adapter** は、このアプリでの認証用の OAuth のサンプル実装であり、デモンストレーションを目的としています。 25 | 26 | これらのスニペットは、簡潔な自己完結型であり、必要に応じて、コピーして独自のコードに貼り付けたり、Microsoft Graph SDK for iOS の使用方法を学習するためのリソースとして使用したりすることができます。参照用にこのサンプルで使用されるすべての未加工のスニペットの一覧については、Wiki の「[サンプル操作一覧](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List)」を参照してください。 27 | 28 | **注:** 可能であれば、"職場以外"のアカウントまたはテスト アカウントでこのサンプルを使用してください。サンプルでは、メールボックスと予定表で作成されたオブジェクトが常にクリーンアップされるとは限りません。現時点では、手動でサンプルのメールと予定表イベントを削除する必要があります。また、メッセージを送受信し、イベントを取得、作成、更新および削除するスニペットは、一部の個人用アカウントでは操作できないことにも注意してください。これらの操作は、それらのアカウントが更新されて Azure AD v2.0 認証エンドポイントで操作できるようになったときに、最終的に機能するようになります。 29 | 30 | 31 | 32 | 33 | ## 前提条件 ## 34 | 35 | このサンプルを実行するには次のものが必要です。 36 | * Apple 社の [Xcode](https://developer.apple.com/xcode/downloads/) 37 | * 依存関係マネージャーとしての [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) のインストール。 38 | * Office 365、outlook.com、hotmail.com などの、Microsoft の職場または個人用のメール アカウント。Office 365 アプリのビルドを開始するために必要なリソースを含む、[Office 365 Developer サブスクリプション](https://aka.ms/devprogramsignup)にサインアップできます。 39 | * [Microsoft Graph アプリ登録ポータル](https://graph.microsoft.io/en-us/app-registration) で登録済みのアプリのクライアント ID 40 | * 前述のように、認証要求を実行するには、適切な OAuth 2.0 ベアラー トークンを使用して HTTPS 要求を認証できる **MSAuthenticationProvider** を指定する必要があります。 41 | 42 | 43 | 44 | 45 | ## アプリを登録して構成する 46 | 47 | 1. 個人用アカウント、あるいは職場または学校アカウントのいずれかを使用して、[アプリ登録ポータル](https://apps.dev.microsoft.com/)にサインインします。 48 | 2. **[アプリの追加]** を選択します。 49 | 3. アプリの名前を入力して、**[アプリケーションの作成]** を選択します。登録ページが表示され、アプリのプロパティが一覧表示されます。 50 | 4. **[プラットフォーム]** で、**[プラットフォームの追加]** を選択します。 51 | 5. **[モバイル アプリケーション]** を選択します。 52 | 6. 後で使用するために、クライアント ID (アプリ ID) をコピーします。サンプル アプリにこの値を入力する必要があります。アプリ ID は、アプリの一意識別子です。 53 | 7. **[保存]** を選択します。 54 | 55 | 56 | ## キーチェーンの共有を有効にする 57 | 58 | Xcode 8 には、キーチェーンのグループを追加する必要があります。これを行わないと、アプリがキーチェーンにアクセスできなくなります。キーチェーン グループを追加するには: 59 | 60 | 1. Xcode のプロジェクト マネージャーのパネルで、プロジェクトを選択します (⌘ + 1)。 61 | 62 | 2. **iOS-objectivec-snippets-sample** を選択します。 63 | 64 | 3. [機能] タブで **[キーチェーンを共有]** を有効にする。 65 | 66 | 4. **com.microsoft.iOS-objectivec-snippets-sample** をキーチェーンのグループに追加します。 67 | 68 | 69 | ## ビルドとデバッグ 70 | 71 | 1. このリポジトリの複製を作成する 72 | 2. CocoaPods を使用して、Microsoft Graph SDK と認証の依存関係をインポートします: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | このサンプル アプリには、プロジェクトに pod を取り込む podfile が既に含まれています。**ターミナル**からプロジェクトに移動して次を実行するだけです: 79 | 80 | pod install 81 | 82 | 詳細については、[その他のリソース](#AdditionalResources)の「**CocoaPods を使う**」を参照してください 83 | 84 | 3. **O365-iOS-Microsoft-Graph-SDK.xcworkspace** を開きます 85 | 4. **AuthenticationConstants.m** を開きます。登録プロセスの **ClientID** がファイルの一番上に追加されていることが分かります。: 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > 注:このサンプルを使用するために必要なアクセス許可の適用範囲の詳細については、以下の「**サンプルの実行**」セクションをご覧ください。 91 | 5. サンプルを実行します。 92 | 93 | 94 | ## サンプルの実行 95 | 96 | 起動すると、共通のユーザー タスクを表す一連のボックスがアプリに表示されます。これらのタスクは、アカウントの種類とアクセス許可のレベルに基づいて実行できます: 97 | 98 | - メールの送受信、ファイルの作成など、職場または学校のアカウントおよび個人用アカウントの両方に適用可能なタスク。 99 | - ユーザーの上司またはアカウントの写真の取得など、職場または学校のアカウントにのみ適用可能なタスク。 100 | - グループ メンバーの取得または新しいユーザーの作成など、管理アクセス許可を持つ職場または学校のアカウントにのみ適用可能なタスク。 101 | 102 | 実行するタスクを選択し、それをクリックして実行します。選択したタスクに適用可能なアクセス許可のないアカウントでログインすると、タスクが失敗しますので注意してください。たとえば、組織内の管理権限のないアカウントからすべてのテナント グループを取得するなど、特定のスニペットを実行しようとすると、その操作は失敗します。または、hotmail.com などの個人用アカウントでログインしている場合にサインインしているユーザーの上司を取得しようとすると、失敗します。 103 | 104 | 現在、このサンプル アプリは Authentication\AuthenticationConstants.m にある次の適用範囲で構成されています: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | 上記で定義された適用範囲を使用するだけで、複数の操作を実行することができます。ただし、適切に実行するために管理権限を必要とするタスクも一部あり、そのタスクは UI 上で管理者アクセスが必要であるとしてマークされます。管理者は、次の適用範囲を Authentication.constants.m に追加して、これらのスニペットを実行できる場合があります: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | また、管理者、組織、または個人の各アカウントに対して実行できるスニペットを確認するには、スニペット ライブラリ/Snippets.m も参照してください。各スニペットの説明は、アクセスのレベルについて詳しく説明しています。 121 | 122 | 123 | ##サンプルによるテナント データへの影響 124 | このサンプルでは、データを作成、読み取り、更新、または削除するコマンドを実行します。データを削除、または編集するコマンドを実行すると、サンプルではテスト エンティティが作成されます。サンプルでは、これらの一部のエンティティが削除されずにテナントに残ります。 125 | 126 | 127 | ## 投稿 128 | 129 | このサンプルに投稿する場合は、[CONTRIBUTING.MD](/CONTRIBUTING.md) を参照してください。 130 | 131 | このプロジェクトでは、[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) が採用されています。詳細については、「[規範に関する FAQ](https://opensource.microsoft.com/codeofconduct/faq/)」を参照してください。または、その他の質問やコメントがあれば、[opencode@microsoft.com](mailto:opencode@microsoft.com) までにお問い合わせください。 132 | 133 | 134 | ## 質問とコメント 135 | 136 | Microsoft Graph iOS Objective C スニペットのサンプル プロジェクトに関するフィードバックをお寄せください。質問や提案につきましては、このリポジトリの「[問題](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues)」セクションで送信できます。 137 | 138 | お客様からのフィードバックを重視しています。[スタック オーバーフロー](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph)でご連絡いただけます。ご質問には [MicrosoftGraph] のタグを付けてください。 139 | 140 | 141 | ## 追加リソース 142 | 143 | - [Microsoft Graph の概要](http://graph.microsoft.io) 144 | - [Office 開発者向けコード サンプル](http://dev.office.com/code-samples) 145 | - [Office デベロッパー センター](http://dev.office.com/) 146 | 147 | 148 | ## 著作権 149 | Copyright (c) 2016 Microsoft. All rights reserved. 150 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # [ARCHIVED] Microsoft Graph iOS Objective C Snippets Sample 2 | 3 | ## IMPORTANT 4 | 5 | **This project is being archived. As part of the archival process, we're closing all open issues and pull requests. For a current Objective-C sample, see [ios-objectivec-connect-sample](https://github.com/microsoftgraph/ios-objectivec-connect-sample)** 6 | 7 | **You can continue to use this sample "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.** 8 | 9 | **Table of contents** 10 | 11 | * [Introduction](#introduction) 12 | * [Prerequisites](#prerequisites) 13 | * [Register and configure the app](#register) 14 | * [Enable keychain sharing](#keychain) 15 | * [Build and debug](#build) 16 | * [Running the sample](#run) 17 | * [How the sample affects your tenant data](#how-the-sample-affects-your-tenant-data) 18 | * [Questions and comments](#questions) 19 | * [Additional resources](#additional-resources) 20 | 21 | 22 | ## Introduction 23 | 24 | This sample contains a repository of code snippets that show how to use the Microsoft Graph SDK to send email, manage groups, and perform other activities with Office 365 data. It uses the [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) to work with data returned by Microsoft Graph. 25 | 26 | This repository shows you how to access multiple resources, including Microsoft Azure Active Directory (AD) and the Office 365 APIs, by making HTTP requests to the Microsoft Graph API in an iOS app. 27 | 28 | In addition, the sample uses [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) for authentication. To make requests, an **MSAuthenticationProvider** must be provided which is capable of authenticating HTTPS requests with an appropriate OAuth 2.0 bearer token. We will be using this framework for a sample implementation of MSAuthenticationProvider that can be used to jump-start your project. 29 | 30 | > **Note** The **msgraph-sdk-ios-nxoauth2-adapter** is a sample OAuth implementation for authentication in this app and meant for demonstration purposes. 31 | 32 | These snippets are simple and self-contained, and you can copy and paste them into your own code, whenever appropriate, or use them as a resource for learning how to use the Microsoft Graph SDK for iOS. For a list of all the raw snippets used in this sample for reference, see [Sample operations list](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List) in the wiki. 33 | 34 | **Note:** If possible, please use this sample with a "non-work" or test account. The sample does not always clean up the created objects in your mailbox and calendar. At this time you'll have to manually remove sample mails and calendar events. Also note that the snippets that get and send messages and that get, create, update, and delete events won't work with all personal accounts. These operations will eventually work when those accounts are updated to work with the Azure AD v2.0 endpoint. 35 | 36 | 37 | 38 | 39 | ## Prerequisites ## 40 | 41 | This sample requires the following: 42 | * [XCode](https://developer.apple.com/xcode/downloads/) from Apple 43 | * Installation of [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) as a dependency manager. 44 | * A Microsoft work or personal email account such as Office 365, or outlook.com, hotmail.com, etc. You can sign up for [an Office 365 Developer subscription](https://aka.ms/devprogramsignup) that includes the resources that you need to start building Office 365 apps. 45 | * A client id from the registered app at [Microsoft Graph App Registration Portal](https://graph.microsoft.io/en-us/app-registration) 46 | * As stated above, to make authentication requests, an **MSAuthenticationProvider** must be provided which is capable of authenticating HTTPS requests with an appropriate OAuth 2.0 bearer token. 47 | 48 | 49 | 50 | 51 | ## Register and configure the app 52 | 53 | 1. Sign into the [App Registration Portal](https://apps.dev.microsoft.com/) using either your personal or work or school account. 54 | 2. Select **Add an app**. 55 | 3. Enter a name for the app, and select **Create application**. The registration page displays, listing the properties of your app. 56 | 4. Under **Platforms**, select **Add platform**. 57 | 5. Select **Mobile application**. 58 | 6. Copy the Client Id (App Id) for later use. You'll need to enter this value into the sample app. The app id is a unique identifier for your app. 59 | 7. Select **Save**. 60 | 61 | 62 | ## Enable keychain sharing 63 | 64 | For Xcode 8, you'll need to add the keychain group or your app will fail to access the keychain. 65 | To add the keychain group: 66 | 67 | 1. Select the project on the project manager panel in Xcode. (⌘ + 1). 68 | 69 | 2. Select **iOS-objectivec-snippets-sample**. 70 | 71 | 3. On the Capabilities tab, enable **Keychain Sharing**. 72 | 73 | 4. Add **com.microsoft.iOS-objectivec-snippets-sample** to the Keychain Groups. 74 | 75 | 76 | ## Build and debug 77 | 78 | 1. Clone this repository 79 | 2. Use CocoaPods to import the Microsoft Graph SDK and authentication dependencies: 80 | 81 | pod 'MSGraphSDK' 82 | pod 'MSGraphSDK-NXOAuth2Adapter' 83 | 84 | 85 | This sample app already contains a podfile that will get the pods into the project. Simply navigate to the project From **Terminal** and run: 86 | 87 | pod install 88 | 89 | For more information, see **Using CocoaPods** in [Additional Resources](#AdditionalResources) 90 | 91 | 3. Open **O365-iOS-Microsoft-Graph-SDK.xcworkspace** 92 | 4. Open **AuthenticationConstants.m**. You'll see that the **ClientID** from the registration process can be added to the top of the file.: 93 | 94 | // You will set your application's clientId 95 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 96 | 97 | > Note: For more information on permission scopes required to use this sample, see the below section **Running the sample.** 98 | 5. Run the sample. 99 | 100 | 101 | ## Running the sample 102 | 103 | When launched, the app displays a series of boxes representing common user tasks. These tasks can be run based on account type and permission level: 104 | 105 | - Tasks that are applicable to both work or school and personal accounts, such as getting and sending email, creating files, etc. 106 | - Tasks that are only applicable to work or school accounts, such as getting a user's manager or account photo. 107 | - Tasks that are only applicable to a work or school account with administrative permissions, such as getting group members or creating new user accounts. 108 | 109 | Select the task that you want to perform and click on it to run. Be aware that if you log in with an account that doesn't have applicable permissions for the tasks you've selected they'll fail. For example if try to run a particular snippet, like get all tenant groups, from an account that doesn't not have admin privileges in the org the operation will fail. Or, if you log in with a personal account like hotmail.com and attempt to get the manager of the signed in user, it will fail. 110 | 111 | Currently this sample app is configured with the following scopes located in Authentication\AuthenticationConstants.m: 112 | 113 | "https://graph.microsoft.com/User.Read", 114 | "https://graph.microsoft.com/User.ReadWrite", 115 | "https://graph.microsoft.com/User.ReadBasic.All", 116 | "https://graph.microsoft.com/Mail.Send", 117 | "https://graph.microsoft.com/Calendars.ReadWrite", 118 | "https://graph.microsoft.com/Mail.ReadWrite", 119 | "https://graph.microsoft.com/Files.ReadWrite", 120 | 121 | You'll be able to perform several operations just using the scopes defined above. However, there are some tasks that require admin privileges to run properly, and the tasks in the UI will be marked as requiring admin access. Administrators may add the following scopes to Authentication.constants.m to run these snippets: 122 | 123 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 124 | "https://graph.microsoft.com/User.ReadWrite.All" 125 | "https://graph.microsoft.com/Group.ReadWrite.All" 126 | 127 | Also, to see what snippets can be run against an admin, organization, or personal accounts see Snippets Library/Snippets.m. Each snippet description will detail the level of access. 128 | 129 | 130 | ##How the sample affects your tenant data 131 | This sample runs commands that create, read, update, or delete data. When running commands that delete or edit data, the sample creates test entities. The sample will leave behind some of these entities on your tenant. 132 | 133 | 134 | ## Contributing 135 | 136 | If you'd like to contribute to this sample, see [CONTRIBUTING.MD](/CONTRIBUTING.md). 137 | 138 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 139 | 140 | 141 | ## Questions and comments 142 | 143 | We'd love to get your feedback about the Microsoft Graph iOS Objective C Snippets Sample project. You can send your questions and suggestions to us in the [Issues](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) section of this repository. 144 | 145 | Your feedback is important to us. Connect with us on [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph). Tag your questions with [MicrosoftGraph]. 146 | 147 | 148 | ## Additional resources 149 | 150 | - [Microsoft Graph overview](http://graph.microsoft.io) 151 | - [Office developer code samples](http://dev.office.com/code-samples) 152 | - [Office dev center](http://dev.office.com/) 153 | 154 | 155 | ## Copyright 156 | Copyright (c) 2016 Microsoft. All rights reserved. 157 | -------------------------------------------------------------------------------- /README-Localized/README-pt-br.md: -------------------------------------------------------------------------------- 1 | # Exemplo de Trechos de Código do iOS Objective C do Microsoft Graph 2 | 3 | **Sumário** 4 | 5 | * [Introdução](#introduction) 6 | * [Pré-requisitos](#prerequisites) 7 | * [Registrar e configurar o aplicativo](#register) 8 | * [Habilitar o compartilhamento de chaves](#keychain) 9 | * [Compilar e depurar](#build) 10 | * [Executar o exemplo](#run) 11 | * [Como o exemplo afeta os dados do locatário](#how-the-sample-affects-your-tenant-data) 12 | * [Perguntas e comentários](#questions) 13 | * [Recursos adicionais](#additional-resources) 14 | 15 | 16 | ## Introdução 17 | 18 | Este exemplo contém um repositório de trechos de código que mostram como usar o SDK do Microsoft Graph SDK enviar emails, gerenciar grupos e realizar outras atividades com os dados do Office 365. O exemplo usa o [SDK do Microsoft Graph para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) para trabalhar com dados retornados pelo Microsoft Graph. 19 | 20 | Este exemplo mostra como acessar vários recursos, incluindo o Microsoft Azure Active Directory (AD) e APIs do Office 365, fazendo solicitações HTTP para a API do Microsoft Graph em um aplicativo iOS. 21 | 22 | Além disso, o exemplo usa [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) para autenticação. Para realizar solicitações de autenticação, é necessário fornecer um **MSAuthenticationProvider** para autenticar solicitações HTTPS com um token de portador OAuth 2.0 apropriado. Usaremos essa estrutura para uma implementação de exemplo de MSAuthenticationProvider que pode ser usada para acelerar seu projeto. 23 | 24 | > **Observação** o adaptador **msgraph-sdk-ios-nxoauth2-adapter** é uma implementação OAuth para autenticação de exemplo neste aplicativo, e serve para demonstrações. 25 | 26 | Esses trechos são simples e autocontidos e você pode copiá-los e colá-los em seu próprio código, sempre que apropriado, ou usá-los como um recurso para aprender a usar o SDK do Microsoft Graph para iOS. Para obter uma lista de todos os trechos de código brutos usados neste exemplo para referência, consulte [Lista de operações de exemplo](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List) na wiki. 27 | 28 | **Observação:** Se possível, use este exemplo com uma conta "não comercial" ou de teste. O exemplo nem sempre limpa os objetos criados em sua caixa de correio e calendário. Neste momento, você terá que remover manualmente os exemplos de correios e eventos do calendário. Observe também que os trechos de código que recebem e enviam mensagens e que recebem, criam, atualizam e excluem eventos não funcionarão com todas as contas pessoais. Essas operações funcionarão quando essas contas forem atualizadas para funcionar com o ponto de extremidade do Microsoft Azure AD v2.0. 29 | 30 | 31 | 32 | 33 | ## Pré-requisitos ## 34 | 35 | Esse exemplo requer o seguinte: 36 | * [Xcode](https://developer.apple.com/xcode/downloads/) da Apple 37 | * Instalação do [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como um gerente de dependências. 38 | * Uma conta de email comercial ou pessoal da Microsoft como o Office 365, ou outlook.com, hotmail.com, etc. Inscreva-se em uma [Assinatura do Office 365 para Desenvolvedor](https://aka.ms/devprogramsignup) que inclua os recursos necessários para começar a criar aplicativos do Office 365. 39 | * Uma ID de cliente do aplicativo registrado no [Portal de Registro de Aplicativos do Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 40 | * Conforme mencionado acima, para realizar solicitações de autenticação, um **MSAuthenticationProvider** deve ser fornecido para autenticar solicitações HTTPS com um token de portador OAuth 2.0 apropriado. 41 | 42 | 43 | 44 | 45 | ## Registrar e configurar o aplicativo 46 | 47 | 1. Entre no [Portal de Registro do Aplicativo](https://apps.dev.microsoft.com/) usando sua conta pessoal ou sua conta comercial ou escolar. 48 | 2. Selecione **Adicionar um aplicativo**. 49 | 3. Insira um nome para o aplicativo e selecione **Criar aplicativo**. A página de registro é exibida, listando as propriedades do seu aplicativo. 50 | 4. Em **Plataformas**, selecione **Adicionar plataforma**. 51 | 5. Escolha **Aplicativo móvel**. 52 | 6. Copie a ID de Cliente (ID de Aplicativo) para usar posteriormente. Você precisará inserir esse valor no exemplo de aplicativo. Essa ID de aplicativo é o identificador exclusivo do aplicativo. 53 | 7. Selecione **Salvar**. 54 | 55 | 56 | ## Habilitar o compartilhamento de chaves 57 | 58 | Para o Xcode 8, você deve adicionar o grupo de chaves para que o aplicativo não falhe ao acessar a chave. Para adicionar o grupo de chaves: 59 | 60 | 1. Escolha o projeto, no painel do gerente de projetos do Xcode. (⌘+1). 61 | 62 | 2. Escolha **iOS-objectivec-snippets-sample**. 63 | 64 | 3. Na guia Recursos, habilite o **Compartilhamento de chaves**. 65 | 66 | 4. Adicione **com.microsoft.iOS-objectivec-snippets-sample** ao grupo de chaves. 67 | 68 | 69 | ## Compilar e depurar 70 | 71 | 1. Clonar este repositório 72 | 2. Use o CocoaPods para importar as dependências de autenticação e o SDK do Microsoft Graph: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | Este aplicativo de exemplo já contém um podfile que colocará os pods no projeto. Simplesmente navegue até o projeto do **Terminal** e execute: 79 | 80 | pod install 81 | 82 | Para saber mais, confira o artigo **Usar o CocoaPods** em [Recursos Adicionais](#AdditionalResources) 83 | 84 | 3. Abrir **O365-iOS-Microsoft-Graph-SDK.xcworkspace** 85 | 4. Abra **AuthenticationConstants.m**. Observe que você pode adicionar o valor de **ClientID** do processo de registro, na parte superior do arquivo. 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > Observação: Para obter mais informações sobre escopos de permissão necessários para usar esse exemplo, consulte a seção **Execução do exemplo** abaixo. 91 | 5. Execute o exemplo. 92 | 93 | 94 | ## Execução do exemplo 95 | 96 | Quando iniciado, o aplicativo exibe uma série de caixas que representam tarefas comuns do usuário. Essas tarefas podem ser executadas com base no nível de permissão e de tipo de conta: 97 | 98 | - Tarefas que são aplicáveis a contas comerciais ou escolares e contas pessoais, como receber e enviar emails, criar arquivos, etc. 99 | - Tarefas que só são aplicáveis a contas comerciais ou escolares, como receber a foto da conta e o gerenciador do usuário. 100 | - Tarefas que só são aplicáveis a contas comerciais ou escolares com permissões administrativas, como receber membros do grupo ou criar novas contas de usuário. 101 | 102 | Escolha a tarefa que você deseja realizar e clique nela para executar. Lembre-se de que se você fizer logon com uma conta que não tem permissões aplicáveis para as tarefas selecionadas, elas falharão. Por exemplo, se você tentar executar um determinado trecho de código, como obter todos os grupos de um locatário, de uma conta que não tem privilégios de administrador na organização, a operação falhará. Ou, se você fizer logon usando uma conta pessoal, como hotmail.com, e tentar obter o gerenciador do usuário conectado, a operação falhará. 103 | 104 | No momento, este exemplo de aplicativo está configurado com os seguintes escopos localizados em Authentication\AuthenticationConstants.m: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | Você poderá realizar várias operações usando apenas os escopos definidos acima. No entanto, há algumas tarefas que exigem privilégios de administrador para serem executadas corretamente. Além disso, as tarefas na interface de usuário serão marcadas como precisando de acesso de administrador. Os administradores podem adicionar os seguintes escopos a Authentication.constants.m para executar esses trechos de código: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | Além disso, para ver quais trechos de código podem ser executados em uma conta de administrador, da organização ou pessoal, consulte Snippets Library/Snippets.m. A descrição de cada trecho de código detalhará o nível de acesso. 121 | 122 | 123 | ##Como o exemplo afeta os dados do locatário 124 | Este exemplo executa comandos que criam, leem, atualizam ou excluem dados. Durante a execução de comandos que excluem ou editam dados, o exemplo cria entidades de teste. O exemplo deixará algumas dessas entidades em seu locatário. 125 | 126 | 127 | ## Colaboração 128 | 129 | Se quiser contribuir para esse exemplo, confira [CONTRIBUTING.MD](/CONTRIBUTING.md). 130 | 131 | Este projeto adotou o [Código de Conduta do Código Aberto da Microsoft](https://opensource.microsoft.com/codeofconduct/). Para saber mais, confira as [Perguntas frequentes do Código de Conduta](https://opensource.microsoft.com/codeofconduct/faq/) ou contate [opencode@microsoft.com](mailto:opencode@microsoft.com) se tiver outras dúvidas ou comentários. 132 | 133 | 134 | ## Perguntas e comentários 135 | 136 | Adoraríamos receber seus comentários sobre o projeto Exemplo de Trechos de Código do iOS Objective C do Microsoft Graph. Você pode nos enviar suas perguntas e sugestões por meio da seção [Issues](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) deste repositório. 137 | 138 | Seus comentários são importantes para nós. Junte-se a nós na página [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph). Marque suas perguntas com [MicrosoftGraph]. 139 | 140 | 141 | ## Recursos adicionais 142 | 143 | - [Visão geral do Microsoft Graph](http://graph.microsoft.io) 144 | - [Exemplos de código para desenvolvedores do Office](http://dev.office.com/code-samples) 145 | - [Centro de Desenvolvimento do Office](http://dev.office.com/) 146 | 147 | 148 | ## Direitos autorais 149 | Copyright © 2016 Microsoft. Todos os direitos reservados. 150 | -------------------------------------------------------------------------------- /README-Localized/README-ru-ru.md: -------------------------------------------------------------------------------- 1 | # Пример фрагментов кода на языке Objective C для iOS для Microsoft Graph 2 | 3 | **Содержание** 4 | 5 | * [Введение](#introduction) 6 | * [Необходимые компоненты](#prerequisites) 7 | * [Регистрация и настройка приложения](#register) 8 | * [Включение общего доступа к цепочке ключей](#keychain) 9 | * [Сборка и отладка](#build) 10 | * [Запуск примера](#run) 11 | * [Влияние примера на данные клиента](#how-the-sample-affects-your-tenant-data) 12 | * [Вопросы и комментарии](#questions) 13 | * [Дополнительные ресурсы](#additional-resources) 14 | 15 | 16 | ## Введение 17 | 18 | Этот пример содержит репозиторий фрагментов кода, которые показывают, как использовать пакет SDK Microsoft Graph, чтобы отправлять сообщения электронной почты, управлять группами и выполнять другие действия с данными Office 365. Для работы с данными, возвращаемыми Microsoft Graph, используется [пакет SDK Microsoft Graph для iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 19 | 20 | Этот репозиторий показывает, как получить доступ к нескольким ресурсам, в том числе Microsoft Azure Active Directory (AD) и API Office 365, совершая HTTP-запросы в API Microsoft Graph в приложении iOS. 21 | 22 | Кроме того, для проверки подлинности в примере используется [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter). Чтобы отправлять запросы, необходимо указать протокол **MSAuthenticationProvider**, который способен проверять подлинность HTTPS-запросов с помощью соответствующего маркера носителя OAuth 2.0. Мы будем использовать эту платформу для реализации протокола MSAuthenticationProvider и быстрого запуска проекта. 23 | 24 | > **Примечание.** **msgraph-sdk-ios-nxoauth2-adapter** — это пример реализации OAuth для проверки подлинности в этом приложении, который используется в целях демонстрации. 25 | 26 | При необходимости вы можете копировать эти простые и автономные фрагменты кода, вставлять их в собственный код или использовать в качестве ресурса, чтобы научиться использовать пакет SDK Microsoft Graph для iOS. Список всех необработанных фрагментов кода, используемых в этом примере для справки, см. в статье [Список примеров операций](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List) на вики-сайте. 27 | 28 | **Примечание.** Если возможно, используйте этот пример с "нерабочей" или тестовой учетной записью. Если вы используете пример, созданные объекты в почтовом ящике и календаре не всегда очищаются. В настоящее время вам необходимо вручную удалить примеры сообщений и событий календаря. Обратите внимание, что фрагменты кода, которые используются для получения и отправки сообщений, а также получения, создания, обновления и удаления событий, работают не со всеми личными учетными записями. Настоящие операции будут поддерживаться в полном объеме, когда эти учетные записи будут обновлены для работы с конечной точкой Azure AD версии 2.0. 29 | 30 | 31 | 32 | 33 | ## Необходимые компоненты ## 34 | 35 | Для этого примера требуются следующие компоненты: 36 | * [Xcode](https://developer.apple.com/xcode/downloads/) от Apple. 37 | * Установка [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) в качестве диспетчера зависимостей. 38 | * Рабочая или личная учетная запись Майкрософт, например Office 365, outlook.com или hotmail.com. Вы можете [подписаться на план Office 365 для разработчиков](https://aka.ms/devprogramsignup), который включает ресурсы, необходимые для создания приложений Office 365. 39 | * Идентификатор клиента из приложения, зарегистрированного на [портале регистрации приложений Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 40 | * Как указывалось выше, для отправки запросов на проверку подлинности необходимо указать протокол **MSAuthenticationProvider**, который способен проверять подлинность HTTPS-запросов с помощью соответствующего маркера носителя OAuth 2.0. 41 | 42 | 43 | 44 | 45 | ## Регистрация и настройка приложения 46 | 47 | 1. Войдите на [портал регистрации приложений](https://apps.dev.microsoft.com/) с помощью личной, рабочей или учебной учетной записи. 48 | 2. Выберите пункт **Добавить приложение**. 49 | 3. Введите имя приложения и выберите пункт **Создать приложение**. Откроется страница регистрации со свойствами приложения. 50 | 4. В разделе **Платформы** выберите пункт **Добавление платформы**. 51 | 5. Выберите пункт **Мобильное приложение**. 52 | 6. Скопируйте идентификатор клиента (идентификатор приложения) для дальнейшего использования. Это значение потребуется ввести в примере приложения. Идентификатор приложения является уникальным. 53 | 7. Нажмите кнопку **Сохранить**. 54 | 55 | 56 | ## Включение общего доступа к цепочке ключей 57 | 58 | Для Xcode 8 необходимо добавить группу цепочки ключей. В противном случае приложению не удастся получить доступ к цепочке ключей. Чтобы добавить группу цепочки ключей: 59 | 60 | 1. На панели управления проектом в Xcode выберите нужный проект (клавиши ⌘+1). 61 | 62 | 2. Выберите **iOS-objectivec-snippets-sample**. 63 | 64 | 3. На вкладке "Возможности" включите **общий доступ к цепочке ключей**. 65 | 66 | 4. В группы цепочки ключей добавьте **com.microsoft.iOS-objectivec-snippets-sample**. 67 | 68 | 69 | ## Сборка и отладка 70 | 71 | 1. Клонируйте этот репозиторий 72 | 2. Импортируйте зависимости пакета SDK Microsoft Graph и проверки подлинности с помощью CocoaPods: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | Этот пример приложения уже содержит podfile, который добавит компоненты pod в проект. Просто перейдите к проекту из раздела **Терминал** и выполните следующую команду: 79 | 80 | pod install 81 | 82 | Для получения дополнительных сведений выберите ссылку **Использование CocoaPods** в разделе [Дополнительные ресурсы](#AdditionalResources). 83 | 84 | 3. Откройте **O365-iOS-Microsoft-Graph-SDK.xcworkspace**. 85 | 4. Откройте файл **AuthenticationConstants.m**. Вы увидите, что в верхнюю часть файла можно добавить **идентификатор клиента**, скопированный в ходе регистрации. 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > Примечание. Дополнительные сведения об областях разрешений, необходимых для использования этого примера, см. ниже в разделе **Выполнение примера**. 91 | 5. Запустите пример. 92 | 93 | 94 | ## Запуск приложения 95 | 96 | При запуске приложения отображается набор полей, представляющих собой типичные задачи пользователя. Эти задачи можно выполнять в зависимости от типа учетной записи и уровня разрешений. 97 | 98 | - Задачи, доступные для рабочих, учебных и личных учетных записей, например получение и отправка электронной почты, создание файлов и т. д. 99 | - Задачи, доступные только для рабочих или учебных учетных записей, например получение фотографии учетной записи или сведений о руководителе пользователя. 100 | - Задачи, доступные только для рабочей или учебной учетной записи с административными разрешениями, например получение сведений о членах группы или создание учетных записей пользователей. 101 | 102 | Выберите задачу, которую необходимо выполнить, и щелчком запустите ее. Обратите внимание, что при входе в систему с помощью учетной записи, не имеющей соответствующих разрешений для выбранных задач, последние невозможно выполнить. Например, если вы попытаетесь выполнить определенный фрагмент кода (например, получить все клиентские группы) из учетной записи без прав администратора в организации, операция завершится ошибкой. Если вы войдете в систему с помощью личной учетной записи, например hotmail.com, вам не удастся получить сведения о руководителе пользователя, который вошел в систему. 103 | 104 | В настоящее время этот пример приложения настроен со следующими областями, расположенными в Authentication\AuthenticationConstants.m: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | Вы сможете выполнить несколько операций, просто используя определенные выше области. Однако есть задачи, для правильного выполнения которых требуются права администратора. Такие задачи будут помечены в пользовательском интерфейсе как требующие доступа администратора. Администраторы могут добавить в Authentication.constants.m следующие области, чтобы выполнить эти фрагменты кода: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | Кроме того, в Snippets Library/Snippets.m можно узнать, какие фрагменты кода можно выполнять в учетной записи администратора или организации, а также личной учетные записи. В каждом описании фрагмента кода указывается уровень доступа. 121 | 122 | 123 | ##Влияние примера на данные клиента 124 | В этом примере выполняются команды по созданию, чтению, обновлению и удалению данных. При выполнении команд по удалению или изменению данных пример создает тестовые сущности. Пример проигнорирует некоторые из этих сущностей в клиенте. 125 | 126 | 127 | ## Помощь 128 | 129 | Если вы хотите добавить код в этот пример, просмотрите статью [CONTRIBUTING.MD](/CONTRIBUTING.md). 130 | 131 | Этот проект соответствует [правилам поведения Майкрософт, касающимся обращения с открытым кодом](https://opensource.microsoft.com/codeofconduct/). Читайте дополнительные сведения в [разделе вопросов и ответов по правилам поведения](https://opensource.microsoft.com/codeofconduct/faq/) или отправляйте новые вопросы и замечания по адресу [opencode@microsoft.com](mailto:opencode@microsoft.com). 132 | 133 | 134 | ## Вопросы и комментарии 135 | 136 | Мы будем рады получить ваши отзывы о проекте примера фрагментов кода на языке Objective C для iOS для Microsoft Graph. Вы можете отправлять нам вопросы и предложения на вкладке [Issues](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) (Проблемы) этого репозитория. 137 | 138 | Ваш отзыв важен для нас. Для связи с нами используйте сайт [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph). Помечайте свои вопросы тегом [MicrosoftGraph]. 139 | 140 | 141 | ## Дополнительные ресурсы 142 | 143 | - [Общие сведения о Microsoft Graph](http://graph.microsoft.io) 144 | - [Примеры кода приложений для Office](http://dev.office.com/code-samples) 145 | - [Центр разработки для Office](http://dev.office.com/) 146 | 147 | 148 | ## Авторское право 149 | (c) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены. 150 | -------------------------------------------------------------------------------- /README-Localized/README-es-es.md: -------------------------------------------------------------------------------- 1 | # Ejemplo de fragmentos de código C del objetivo iOS de Microsoft Graph 2 | 3 | **Tabla de contenido** 4 | 5 | * [Introducción](#introduction) 6 | * [Requisitos previos](#prerequisites) 7 | * [Registrar y configurar la aplicación](#register) 8 | * [Habilitar el uso compartido de llaves](#keychain) 9 | * [Compilar y depurar](#build) 10 | * [Ejecución del ejemplo](#run) 11 | * [Repercusión de la muestra en los datos del inquilino](#how-the-sample-affects-your-tenant-data) 12 | * [Preguntas y comentarios](#questions) 13 | * [Recursos adicionales](#additional-resources) 14 | 15 | 16 | ## Introducción 17 | 18 | Este ejemplo contiene un repositorio de fragmentos de código que muestran cómo usar Microsoft Graph SDK para enviar correos electrónicos, administrar grupos y realizar otras actividades con los datos de Office 365. Usa [Microsoft Graph SDK para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) para trabajar con los datos devueltos por Microsoft Graph. 19 | 20 | Este repositorio muestra cómo tener acceso a varios recursos, incluyendo Microsoft Azure Active Directory (AD) y las API de Office 365, realizando solicitudes HTTP a la API de Microsoft Graph en una aplicación de iOS. 21 | 22 | Además, el ejemplo usa [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) para la autenticación. Para realizar solicitudes, se debe proporcionar un **MSAuthenticationProvider** que sea capaz de autenticar solicitudes HTTPS con un token de portador OAuth 2.0 adecuado. Usaremos este marco de trabajo para una implementación del ejemplo de MSAuthenticationProvider que puede usarse para poner en marcha el proyecto. 23 | 24 | > **Nota** El **msgraph-sdk-ios-nxoauth2-adapter** es un ejemplo de implementación de OAuth para la autenticación en esta aplicación y está diseñado para fines ilustrativos. 25 | 26 | Estos fragmentos de código son simples e independientes, y puede copiarlos y pegarlos en su propio código, cuando proceda o usarlos como un recurso para aprender a usar el SDK de Microsoft Graph para iOS. Para obtener una lista de todos los fragmentos de código sin procesar usada en este ejemplo como referencia, consulte la [Lista de operaciones de ejemplo](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List) en la página wiki. 27 | 28 | **Nota:** Si es posible, use este ejemplo con una cuenta de prueba o "no profesional". El ejemplo no siempre limpia los objetos creados en el buzón de correo y el calendario. En este momento, tendrá que eliminar manualmente los eventos del calendario y los correos del ejemplo. Tenga en cuenta que los fragmentos de código que reciben y envían mensajes, y que obtienen, crean, actualizan y eliminan eventos no funcionarán con todas las cuentas personales. Estas operaciones funcionarán finalmente cuando esas cuentas se actualicen para su funcionamiento con el punto de conexión v2.0 de Azure AD. 29 | 30 | 31 | 32 | 33 | ## Requisitos previos ## 34 | 35 | Este ejemplo necesita lo siguiente: 36 | * [XCode](https://developer.apple.com/xcode/downloads/) de Apple 37 | * Instalación de [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como administrador de dependencias. 38 | * Una cuenta de correo electrónico personal o profesional de Microsoft como Office 365, outlook.com, hotmail.com, etc. Puede registrarse para [una suscripción de Office 365 Developer](https://aka.ms/devprogramsignup), que incluye los recursos que necesita para comenzar a crear aplicaciones de Office 365. 39 | * Un Id. de cliente de la aplicación registrada en el [Portal de registro de la aplicación de Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 40 | * Como se mencionó anteriormente, para realizar solicitudes de autenticación, se debe proporcionar un **MSAuthenticationProvider** que sea capaz de autenticar solicitudes HTTPS con un token de portador OAuth 2.0 adecuado. 41 | 42 | 43 | 44 | 45 | ## Registrar y configurar la aplicación 46 | 47 | 1. Inicie sesión en el [Portal de registro de la aplicación](https://apps.dev.microsoft.com/) mediante su cuenta personal, profesional o educativa. 48 | 2. Seleccione **Agregar una aplicación**. 49 | 3. Escriba un nombre para la aplicación y seleccione **Crear aplicación**. Se muestra la página de registro, indicando las propiedades de la aplicación. 50 | 4. En **Plataformas**, seleccione **Agregar plataforma**. 51 | 5. Seleccione **Aplicación móvil**. 52 | 6. Copie el Id. del cliente (Id. de la aplicación) para usar más tarde. Deberá introducir este valor en la aplicación del ejemplo. El id. de la aplicación es un identificador único para su aplicación. 53 | 7. Seleccione **Guardar**. 54 | 55 | 56 | ## Habilitar el uso compartido de cadenas de claves 57 | 58 | Para Xcode 8, necesitará agregar el grupo de llaves o la aplicación no podrá acceder a la llave. Para agregar el grupo de llaves: 59 | 60 | 1. Seleccione el proyecto en el panel de administración de proyectos de Xcode. (⌘ + 1). 61 | 62 | 2. Seleccione **iOS-objectivec-snippets-sample**. 63 | 64 | 3. En la ficha Capacidades, habilite **Uso compartido de llaves**. 65 | 66 | 4. Agregue **com.microsoft.iOS-objectivec-snippets-sample** a los grupos de llaves. 67 | 68 | 69 | ## Compilar y depurar 70 | 71 | 1. Clone este repositorio. 72 | 2. Use CocoaPods para importar el SDK de Microsoft Graph y las dependencias de autenticación: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | Esta aplicación de ejemplo ya contiene un podfile que recibirá los pods en el proyecto. Simplemente vaya al proyecto desde **Terminal** y ejecute: 79 | 80 | pod install 81 | 82 | Para obtener más información, consulte **Usar CocoaPods** en [Recursos adicionales](#AdditionalResources) 83 | 84 | 3. Abra **O365-iOS-Microsoft-Graph-SDK.xcworkspace** 85 | 4. Abra **AuthenticationConstants.m**. Verá que el **ClientID** del proceso de registro se puede agregar a la parte superior del archivo: 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > Nota: Para obtener más información sobre los ámbitos de permiso necesarios para usar este ejemplo, consulte la siguiente sección **Ejecución del ejemplo.** 91 | 5. Ejecute el ejemplo. 92 | 93 | 94 | ## Ejecución del ejemplo 95 | 96 | Al iniciarse, la aplicación muestra una serie de cuadros que representan tareas de usuario comunes. Estas tareas se pueden ejecutar basándose en el tipo de cuenta y nivel de permiso: 97 | 98 | - Tareas que son aplicables a cuentas profesionales, educativas y personales, como recibir y enviar correo electrónico, crear archivos, etc. 99 | - Tareas que solamente son aplicables a cuentas profesionales o educativas, como obtener fotos de administrador o de la cuenta de un usuario. 100 | - Tareas que solo son aplicables a una cuenta profesional o educativa con permisos administrativos, como obtener miembros del grupo o crear nuevas cuentas de usuario. 101 | 102 | Seleccione la tarea que desea realizar y haga clic en ella para ejecutarla. Tenga en cuenta que, si inicia una sesión con una cuenta que no tiene permisos aplicables para las tareas que ha seleccionado, no se realizarán correctamente. Por ejemplo si intenta ejecutar un fragmento de código determinado, como obtener todos los grupos de inquilinos a partir de una cuenta que no tiene privilegios de administrador en la organización, se producirá un error en la operación. O bien, si inicia una sesión con una cuenta personal como hotmail.com e intenta obtener el administrador del usuario con la sesión iniciada, se producirá un error. 103 | 104 | Esta aplicación de ejemplo está configurada actualmente con los siguientes ámbitos ubicados en Authentication\AuthenticationConstants.m: 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | Podrá realizar varias operaciones simplemente usando los ámbitos definidos anteriormente. Pero hay algunas tareas que requieren privilegios de administrador para poder ejecutarse correctamente, y se marcarán las tareas en la interfaz de usuario indicando que requieren acceso de administrador. Los administradores pueden agregar los siguientes ámbitos a Authentication.constants.m para ejecutar estos fragmentos de código: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | Además, para ver qué fragmentos de código se pueden ejecutar con una cuenta de administrador, organizador o cuenta personal, consulte Snippets Library/Snippets.m. La descripción de cada fragmento detallará el nivel de acceso. 121 | 122 | 123 | ##Repercusión de la muestra en los datos del inquilino 124 | Este ejemplo ejecuta comandos que crean, leen, actualizan o eliminan datos. Cuando ejecuta comandos que eliminan o modifican datos, el ejemplo crea entidades de prueba. El ejemplo dejará atrás algunas de estas entidades en su inquilino. 125 | 126 | 127 | ## Colaboradores 128 | 129 | Si le gustaría contribuir a este ejemplo, consulte [CONTRIBUTING.MD](/CONTRIBUTING.md). 130 | 131 | Este proyecto ha adoptado el [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) (Código de conducta de código abierto de Microsoft). Para obtener más información, consulte las [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) (Preguntas más frecuentes del código de conducta) o póngase en contacto con [opencode@microsoft.com](mailto:opencode@microsoft.com) con otras preguntas o comentarios. 132 | 133 | 134 | ## Preguntas y comentarios 135 | 136 | Nos encantaría recibir sus comentarios acerca del proyecto del ejemplo de fragmentos de código Objective C para iOS de Microsoft Graph. Puede enviarnos sus preguntas y sugerencias a través de la sección [Problemas](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) de este repositorio. 137 | 138 | Su opinión es importante para nosotros. Conecte con nosotros en [Desbordamiento de pila](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph). Etiquete sus preguntas con [MicrosoftGraph]. 139 | 140 | 141 | ## Recursos adicionales 142 | 143 | - [Información general de Microsoft Graph](http://graph.microsoft.io) 144 | - [Ejemplos de código de Office Developer](http://dev.office.com/code-samples) 145 | - [Centro de desarrollo de Office](http://dev.office.com/) 146 | 147 | 148 | ## Copyright 149 | Copyright (c) 2016 Microsoft. Todos los derechos reservados. 150 | -------------------------------------------------------------------------------- /README-Localized/README-de-de.md: -------------------------------------------------------------------------------- 1 | # Beispiel für iOS-Objective C-Codeausschnitte für Microsoft Graph 2 | 3 | **Inhaltsverzeichnis** 4 | 5 | * [Einführung](#introduction) 6 | * [Voraussetzungen](#prerequisites) 7 | * [Registrieren und Konfigurieren der App](#register) 8 | * [Aktivieren der Schlüsselbundfreigabe](#keychain) 9 | * [Erstellen und Debuggen](#build) 10 | * [Ausführen des Beispiels](#run) 11 | * [Wie sich das Beispiel auf Ihre Mandantendaten auswirkt](#how-the-sample-affects-your-tenant-data) 12 | * [Fragen und Kommentare](#questions) 13 | * [Weitere Ressourcen](#additional-resources) 14 | 15 | 16 | ## Einführung 17 | 18 | Dieses Beispiel enthält ein Repository von Codeausschnitten, die zeigen, wie das Microsoft Graph-SDK zum Senden von E-Mails, Verwalten von Gruppen und Ausführen anderer Aktivitäten mit Office 365-Daten verwendet wird. Es verwendet das [Microsoft Graph-SDK für iOS](https://github.com/microsoftgraph/msgraph-sdk-ios), um mit Daten zu arbeiten, die von Microsoft Graph zurückgegeben werden. 19 | 20 | In diesem Repository wird gezeigt, wie Sie auf mehrere Ressourcen, einschließlich Microsoft Azure Active Directory (AD) und die Office 365-APIs, zugreifen, indem Sie HTTP-Anforderungen an die Microsoft Graph-API in einer iOS-App ausführen. 21 | 22 | Außerdem verwendet das Beispiel [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) für die Authentifizierung. Um Anforderungen auszuführen, muss ein **MSAuthenticationProvider** bereitgestellt werden, der HTTPS-Anforderungen mit einem entsprechenden OAuth 2.0-Bearertoken authentifizieren kann. Wir verwenden dieses Framework für eine Beispielimplementierung von MSAuthenticationProvider, die Sie für einen Schnelleinstieg in Ihr Projekt verwenden können. 23 | 24 | > **Hinweis** **msgraph-sdk-ios-nxoauth2-adapter** ist eine Beispielimplementierung von OAuth für die Authentifizierung in dieser App und dient Demonstrationszwecken. 25 | 26 | Diese Ausschnitte sind einfach und eigenständig, und Sie können sie ggf. in Ihren eigenen Code kopieren und einfügen oder als Ressource verwenden, um zu lernen, wie das Microsoft Graph-SDK für iOS verwendet wird. Eine Liste aller Rohcodeausschnitte, die in diesem Beispiel als Referenz verwendet werden, finden Sie im Wiki in der [Beispielvorgangsliste](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List). 27 | 28 | **Hinweis:** Verwenden Sie dieses Beispiel, wenn möglich, mit einem persönlichen Konto oder einem Testkonto. Das Beispiel bereinigt nicht immer die erstellten Objekte in Ihrem Postfach und Kalender. Derzeit müssen Sie Beispiel-E-Mails und -Kalenderereignisse manuell entfernen. Beachten Sie auch, dass die Codeausschnitte, die Nachrichten abrufen und senden und Ereignisse abrufen, erstellen, aktualisieren und löschen, nicht mit allen persönlichen Konten funktionieren. Diese Vorgänge funktionieren dann, wenn diese Konten so aktualisiert werden, dass sie mit dem Azure AD v2.0-Authentifizierungsendpunkt arbeiten. 29 | 30 | 31 | 32 | 33 | ## Voraussetzungen ## 34 | 35 | Für dieses Beispiel ist Folgendes erforderlich: 36 | * [Xcode](https://developer.apple.com/xcode/downloads/) von Apple 37 | * Installation von [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) als ein Abhängigkeits-Manager. 38 | * Ein geschäftliches oder persönliches Microsoft-E-Mail-Konto, z. B. Office 365 oder outlook.com, hotmail.com usw. Sie können sich für ein [Office 365-Entwicklerabonnement](https://aka.ms/devprogramsignup) registrieren. Dieses umfasst die Ressourcen, die Sie zum Erstellen von Office 365-Apps benötigen. 39 | * Eine Client-ID aus der registrierten App unter dem [App-Registrierungsportal von Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 40 | * Wie zuvor erwähnt, muss ein **MSAuthenticationProvider** bereitgestellt werden, der HTTPS-Anforderungen mit einem entsprechenden OAuth 2.0-Bearertoken authentifizieren kann, um Anforderungen auszuführen. 41 | 42 | 43 | 44 | 45 | ## Registrieren und Konfigurieren der App 46 | 47 | 1. Melden Sie sich beim [App-Registrierungsportal](https://apps.dev.microsoft.com/) entweder mit Ihrem persönlichen oder geschäftlichen Konto oder mit Ihrem Schulkonto an. 48 | 2. Klicken Sie auf **App hinzufügen**. 49 | 3. Geben Sie einen Namen für die App ein, und wählen Sie **Anwendung erstellen** aus. Die Registrierungsseite wird angezeigt, und die Eigenschaften der App werden aufgeführt. 50 | 4. Wählen Sie unter **Plattformen** die Option **Plattform hinzufügen** aus. 51 | 5. Wählen Sie **Mobile Anwendung** aus. 52 | 6. Kopieren Sie die Client-ID (App-ID) für die spätere Verwendung. Sie müssen diesen Wert in die Beispiel-App eingeben. Die App-ID ist ein eindeutiger Bezeichner für Ihre App. 53 | 7. Klicken Sie auf **Speichern**. 54 | 55 | 56 | ## Aktivieren der Schlüsselbundfreigabe 57 | 58 | Für Xcode 8 müssen Sie die Schlüsselbundgruppe hinzufügen, sonst kann Ihre App nicht auf den Schlüsselbund zugreifen. So fügen Sie die Schlüsselbundgruppe hinzu 59 | 60 | 1. Wählen Sie im Projekt-Manager-Bereich in Xcode das Projekt aus. (⌘ + 1). 61 | 62 | 2. Wählen **iOS-Objectivec-Codeausschnitte-Sample** aus. 63 | 64 | 3. Aktivieren Sie auf der Registerkarte „Funktionen“ die Option **Schlüsselbundfreigabe**. 65 | 66 | 4. Fügen Sie der Schlüsselbundgruppe **com.microsoft.iOS-objectivec-snippets-sample** hinzu. 67 | 68 | 69 | ## Erstellen und Debuggen 70 | 71 | 1. Klonen dieses Repositorys 72 | 2. Verwenden Sie CocoaPods, um das Microsoft Graph-SDK und Authentifizierungsabhängigkeiten zu importieren: 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | Diese Beispiel-App enthält bereits eine POD-Datei, die die Pods in das Projekt überträgt. Navigieren Sie einfach über das **Terminal** zum Projekt, und führen Sie Folgendes aus: 79 | 80 | pod install 81 | 82 | Weitere Informationen finden Sie im Thema über das **Verwenden von CocoaPods** in [Zusätzliche Ressourcen](#AdditionalResources). 83 | 84 | 3. Öffnen Sie **O365-iOS-Microsoft-Graph-SDK.xcworkspace**. 85 | 4. Öffnen Sie **AuthenticationConstants.m**. Sie werden sehen, dass die **ClientID** aus dem Registrierungsprozess am Anfang der Datei hinzugefügt werden kann: 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > Hinweis: Weitere Informationen zu Berechtigungsbereichen, die für die Verwendung dieses Beispiels erforderlich sind, finden Sie im folgenden Abschnitt **Ausführen des Beispiels**. 91 | 5. Führen Sie das Beispiel aus. 92 | 93 | 94 | ## Ausführen des Beispiels 95 | 96 | Nach dem Start wird in der App eine Reihe von Feldern angezeigt, die allgemeine Benutzeraufgaben darstellen. Diese Aufgaben können basierend auf Kontotyp und Berechtigungsstufe ausgeführt werden: 97 | 98 | - Aufgaben, die sowohl für Geschäfts- oder Schulkonten als auch für persönliche Konten gelten, z. B. das Abrufen und Seden von E-Mails, das Erstellen von Dateien usw. 99 | - Aufgaben, die nur für Geschäfts- oder Schulkonten gelten, z. B. das Abrufen eines Vorgesetzten eines Benutzers oder eines Kontofotos. 100 | - Aufgaben, die nur für Geschäfts- oder Schulkonten mit Administratorberechtigungen gelten, z. B. das Abrufen von Gruppenmitgliedern oder das Erstellen neuer Benutzerkonten. 101 | 102 | Wählen Sie die Aufgabe aus, die Sie ausführen möchten, und klicken Sie darauf, um sie auszuführen. Beachten Sie, dass die ausgewählten Aufgaben fehlschlagen, wenn Sie sich mit einem Konto anmelden, das nicht über die entsprechenden Berechtigungen für die Aufgaben verfügt. Wenn Sie beispielsweise versuchen, einen bestimmten Ausschnitt, z. B. das Abrufen aller Mandantengruppen, auf einem Konto auszuführen, das nicht über Administratorberechtigungen in der Organisation verfügt, schlägt der Vorgang fehl. Oder wenn Sie sich mit einem persönlichen Konto wie Hotmail.com anmelden und versuchen, den Vorgesetzten des angemeldeten Benutzers abzurufen, schlägt dieser Vorgang fehl. 103 | 104 | Diese Beispiel-App ist derzeit mit den folgenden Bereichen in „Authentication\AuthenticationConstants.m“ konfiguriert. 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | Indem Sie nur die oben definierten Bereiche verwenden, können Sie mehrere Vorgänge ausführen. Es gibt allerdings einige Vorgänge, für deren ordnungsgemäßes Ausführen Administratorberechtigungen erforderlich sind, und die Aufgaben in der Benutzeroberfläche werden so gekennzeichnet, dass Administratorzugriff erforderlich ist. Administratoren können die folgenden Bereiche zu „Authentication.constants.m“ hinzufügen, um diese Ausschnitte auszuführen: 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | Informationen darüber, welche Ausschnitte für einen Administrator, eine Organisation oder persönliche Konten ausgeführt werden können, finden Sie unter „Snippets Library/Snippets.m“. In jeder Codeausschnittbeschreibung ist die Zugriffsstufe aufgeführt. 121 | 122 | 123 | ##Wie sich das Beispiel auf Ihre Mandantendaten auswirkt 124 | In diesem Beispiel werden Befehle ausgeführt, mit denen Daten erstellt, aktualisiert oder gelöscht werden. Wenn Sie Befehle ausführen, die Daten löschen oder bearbeiten, erstellt das Beispiel Testentitäten. In dem Beispiel werden einige dieser Entitäten auf Ihrem Mandanten hinterlassen. 125 | 126 | 127 | ## Mitwirkung 128 | 129 | Wenn Sie einen Beitrag zu diesem Beispiel leisten möchten, finden Sie unter [CONTRIBUTING.MD](/CONTRIBUTING.md) weitere Informationen. 130 | 131 | In diesem Projekt wurden die [Microsoft Open Source-Verhaltensregeln](https://opensource.microsoft.com/codeofconduct/) übernommen. Weitere Informationen finden Sie unter [Häufig gestellte Fragen zu Verhaltensregeln](https://opensource.microsoft.com/codeofconduct/faq/), oder richten Sie Ihre Fragen oder Kommentare an [opencode@microsoft.com](mailto:opencode@microsoft.com). 132 | 133 | 134 | ## Fragen und Kommentare 135 | 136 | Wir schätzen Ihr Feedback hinsichtlich des Microsoft Graph UWP Snippets Library-Projekts. Sie können uns Ihre Fragen und Vorschläge über den Abschnitt [Probleme](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) dieses Repositorys senden. 137 | 138 | Ihr Feedback ist uns wichtig. Nehmen Sie unter [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph) Kontakt mit uns auf. Taggen Sie Ihre Fragen mit [MicrosoftGraph]. 139 | 140 | 141 | ## Zusätzliche Ressourcen 142 | 143 | - [Microsoft Graph-Übersicht](http://graph.microsoft.io) 144 | - [Office-Entwicklercodebeispiele](http://dev.office.com/code-samples) 145 | - [Office Dev Center](http://dev.office.com/) 146 | 147 | 148 | ## Copyright 149 | Copyright (c) 2016 Microsoft. Alle Rechte vorbehalten. 150 | -------------------------------------------------------------------------------- /README-Localized/README-fr-fr.md: -------------------------------------------------------------------------------- 1 | # Exemple d’extraits de code Microsoft Graph iOS Objective C 2 | 3 | **Sommaire** 4 | 5 | * [Introduction](#introduction) 6 | * [Conditions préalables](#prerequisites) 7 | * [Enregistrement et configuration de l’application](#register) 8 | * [Activation du partage du trousseau](#keychain) 9 | * [Création et débogage](#build) 10 | * [Exécution de l’exemple](#run) 11 | * [Impact de l’exemple sur vos données client](#how-the-sample-affects-your-tenant-data) 12 | * [Questions et commentaires](#questions) 13 | * [Ressources supplémentaires](#additional-resources) 14 | 15 | 16 | ## Introduction 17 | 18 | Cet exemple contient un référentiel des extraits de code qui illustrent l’utilisation du kit de développement Microsoft Graph pour envoyer des messages électroniques, gérer les groupes et effectuer d’autres activités avec les données d’Office 365. Il utilise le [kit de développement logiciel Microsoft Graph pour iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) pour exploiter les données renvoyées par Microsoft Graph. 19 | 20 | Ce référentiel vous montre comment accéder à plusieurs ressources, notamment Microsoft Azure Active Directory (AD) et les API d’Office 365, en envoyant des requêtes HTTP à l’API Microsoft Graph dans une application iOS. 21 | 22 | En outre, l’exemple utilise [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) pour l’authentification. Pour effectuer des requêtes, vous devez fournir un élément **MSAuthenticationProvider** capable d’authentifier les requêtes HTTPS avec un jeton de support OAuth 2.0 approprié. Nous allons utiliser cette infrastructure pour un exemple d’implémentation de MSAuthenticationProvider qui peut être utilisé pour commencer rapidement votre projet. 23 | 24 | > **Remarque :** **msgraph-sdk-ios-nxoauth2-adapter** est un exemple d’implémentation OAuth pour l’authentification dans cette application. Il est fourni à titre de démonstration. 25 | 26 | Ces extraits sont simples et autonomes, et vous pouvez les copier-coller dans votre propre code, le cas échéant, ou les utiliser comme ressource d’apprentissage sur l’utilisation du kit de développement logiciel Microsoft Graph pour iOS. Pour obtenir la liste de tous les extraits bruts utilisés dans cet exemple à titre de référence, voir [Liste des exemples d’opérations](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/wiki/Sample-Operations-List) dans le site wiki. 27 | 28 | **Remarque :** Si possible, utilisez cet exemple avec un compte de test ou « non professionnel ». L’exemple ne nettoie pas toujours les objets créés dans votre boîte aux lettres et votre calendrier. À ce stade, vous devrez supprimer manuellement les exemples de messages électroniques et les événements de calendrier. Notez également que les extraits de code qui obtiennent et envoient des messages et qui obtiennent, créent, mettent à jour et suppriment des événements qui ne fonctionnent pas avec tous les comptes personnels. Ces opérations fonctionneront finalement lorsque ces comptes seront mis à jour pour fonctionner avec le point de terminaison Azure AD v2.0. 29 | 30 | 31 | 32 | 33 | ## Conditions préalables ## 34 | 35 | Cet exemple nécessite les éléments suivants : 36 | * [XCode](https://developer.apple.com/xcode/downloads/) d’Apple 37 | * Installation de [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) comme gestionnaire de dépendances 38 | * Un compte de messagerie professionnel ou personnel Microsoft comme Office 365 ou outlook.com, hotmail.com, etc. Vous pouvez vous inscrire à [Office 365 Developer](https://aka.ms/devprogramsignup) pour accéder aux ressources dont vous avez besoin afin de commencer à créer des applications Office 365. 39 | * Un ID client de l’application enregistrée auprès du [portail d’inscription de l’application Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 40 | * Comme indiqué ci-dessus, pour effectuer des requêtes d’authentification, vous devez fournir un **MSAuthenticationProvider** capable d’authentifier les requêtes HTTPS avec un jeton de support OAuth 2.0 approprié. 41 | 42 | 43 | 44 | 45 | ## Enregistrement et configuration de l’application 46 | 47 | 1. Connectez-vous au [portail d’inscription des applications](https://apps.dev.microsoft.com/) en utilisant votre compte personnel, professionnel ou scolaire. 48 | 2. Sélectionnez **Ajouter une application**. 49 | 3. Entrez un nom pour l’application, puis sélectionnez **Créer une application**. La page d’inscription s’affiche, répertoriant les propriétés de votre application. 50 | 4. Sous **Plateformes**, sélectionnez **Ajouter une plateforme**. 51 | 5. Sélectionnez **Application mobile**. 52 | 6. Copiez l’ID client (ID d’application) à des fins d’utilisation ultérieure. Vous devrez saisir cette valeur dans l’exemple d’application. L’ID d’application est un identificateur unique pour votre application. 53 | 7. Cliquez sur **Enregistrer**. 54 | 55 | 56 | ## Activation du partage du trousseau 57 | 58 | Pour Xcode 8, vous devez ajouter le groupe de trousseau, sinon votre application ne pourra pas y accéder. Pour ajouter le groupe de trousseau : 59 | 60 | 1. Sélectionnez le projet dans le volet du responsable de projet dans Xcode (⌘ + 1). 61 | 62 | 2. Sélectionnez **iOS-objectivec-snippets-sample**. 63 | 64 | 3. Sous l’onglet Fonctionnalités, activez **Partage du trousseau**. 65 | 66 | 4. Ajoutez **com.microsoft.iOS-objectivec-snippets-sample** aux groupes de trousseau. 67 | 68 | 69 | ## Création et débogage 70 | 71 | 1. Cloner ce référentiel 72 | 2. Utilisez CocoaPods pour importer les dépendances d’authentification et le kit de développement logiciel Microsoft Graph : 73 | 74 | pod 'MSGraphSDK' 75 | pod 'MSGraphSDK-NXOAuth2Adapter' 76 | 77 | 78 | Cet exemple d’application contient déjà un podfile qui recevra les pods dans le projet. Ouvrez simplement le projet à partir de **Terminal** et exécutez : 79 | 80 | pod install 81 | 82 | Pour plus d’informations, consultez la ressource **Utilisation de CocoaPods** dans [Ressources supplémentaires](#AdditionalResources). 83 | 84 | 3. Ouvrez **O365-iOS-Microsoft-Graph-SDK.xcworkspace**. 85 | 4. Ouvrez **AuthenticationConstants.m**. Vous verrez que l’**ID client** du processus d’inscription peut être ajouté à la partie supérieure du fichier : 86 | 87 | // You will set your application's clientId 88 | NSString * const kClientId = @"ENTER_YOUR_CLIENT_ID"; 89 | 90 | > Remarque : Pour plus d’informations sur les étendues d’autorisation requises pour utiliser cet exemple, consultez la section **Exécution de l’exemple** ci-dessous. 91 | 5. Exécutez l’exemple. 92 | 93 | 94 | ## Exécution de l’exemple 95 | 96 | Une fois lancée, l’application affiche une série de cases représentant les tâches courantes de l’utilisateur. Ces tâches peuvent être exécutées en fonction du niveau d’autorisations et du type de compte : 97 | 98 | - Tâches qui s’appliquent à la fois aux comptes professionnels, scolaires et personnels, telles que l’obtention et l’envoi de messages électroniques, la création de fichiers, etc. 99 | - Tâches qui s’appliquent uniquement aux comptes professionnels ou scolaires, telles que l’obtention de la photo de compte ou du responsable d’un utilisateur. 100 | - Tâches qui s’appliquent uniquement aux comptes professionnels ou scolaires avec des autorisations administratives appropriées, telles que l’obtention de membres du groupe ou la création de comptes d’utilisateur. 101 | 102 | Sélectionnez la tâche que vous souhaitez effectuer et cliquez dessus pour l’exécuter. N’oubliez pas que si vous vous connectez avec un compte qui ne dispose pas des autorisations applicables pour les tâches sélectionnées, celles-ci échoueront. Par exemple si vous essayez d’exécuter un extrait spécifique, tel que l’obtention de tous les groupes du client, à partir d’un compte qui ne dispose pas de privilèges d’administrateur dans l’organigramme, l’opération échoue. Sinon, si vous vous connectez avec un compte personnel comme hotmail.com et essayez d’obtenir le responsable de l’utilisateur connecté, l’opération échoue. 103 | 104 | Actuellement, cet exemple d’application est configuré avec les étendues suivantes situées dans Authentication\AuthenticationConstants.m : 105 | 106 | "https://graph.microsoft.com/User.Read", 107 | "https://graph.microsoft.com/User.ReadWrite", 108 | "https://graph.microsoft.com/User.ReadBasic.All", 109 | "https://graph.microsoft.com/Mail.Send", 110 | "https://graph.microsoft.com/Calendars.ReadWrite", 111 | "https://graph.microsoft.com/Mail.ReadWrite", 112 | "https://graph.microsoft.com/Files.ReadWrite", 113 | 114 | Vous pourrez effectuer plusieurs opérations simplement à l’aide des étendues définies ci-dessus. Toutefois, certaines tâches qui exigent des privilèges d’administrateur pour s’exécuter correctement et les tâches dans l’interface utilisateur seront marquées comme nécessitant un accès administrateur. Les administrateurs peuvent ajouter les étendues suivantes à Authentication.constants.m pour exécuter ces extraits de code : 115 | 116 | "https://graph.microsoft.com/Directory.AccessAsUser.All", 117 | "https://graph.microsoft.com/User.ReadWrite.All" 118 | "https://graph.microsoft.com/Group.ReadWrite.All" 119 | 120 | En outre, pour savoir quels extraits peuvent être exécutés sur un compte administrateur, professionnel ou personnel, consultez Snippets Library/Snippets.m. Chaque description de l’extrait de code détaille le niveau d’accès. 121 | 122 | 123 | ##Impact de l’exemple sur vos données client 124 | Cet exemple exécute des commandes qui permettent de créer, lire, mettre à jour ou supprimer des données. Lorsque vous exécutez des commandes qui suppriment ou modifient des données, l’exemple crée des entités de test. L’exemple épargne certaines de ces entités sur votre client. 125 | 126 | 127 | ## Contribution 128 | 129 | Si vous souhaitez contribuer à cet exemple, voir [CONTRIBUTING.MD](/CONTRIBUTING.md). 130 | 131 | Ce projet a adopté le [code de conduite Microsoft Open Source](https://opensource.microsoft.com/codeofconduct/). Pour plus d’informations, reportez-vous à la [FAQ relative au code de conduite](https://opensource.microsoft.com/codeofconduct/faq/) ou contactez [opencode@microsoft.com](mailto:opencode@microsoft.com) pour toute question ou tout commentaire. 132 | 133 | 134 | ## Questions et commentaires 135 | 136 | Nous serions ravis de connaître votre opinion sur l’exemple de projet d’extraits de code Microsoft Graph iOS Objective C. Vous pouvez nous faire part de vos questions et suggestions dans la rubrique [Problèmes](https://github.com/microsoftgraph/iOS-objectiveC-snippets-sample/issues) de ce référentiel. 137 | 138 | Votre avis compte beaucoup pour nous. Communiquez avec nous sur [Stack Overflow](http://stackoverflow.com/questions/tagged/office365+or+microsoftgraph). Posez vos questions avec la balise [MicrosoftGraph]. 139 | 140 | 141 | ## Ressources supplémentaires 142 | 143 | - [Présentation de Microsoft Graph](http://graph.microsoft.io) 144 | - [Exemples de code du développeur Office](http://dev.office.com/code-samples) 145 | - [Centre de développement Office](http://dev.office.com/) 146 | 147 | 148 | ## Copyright 149 | Copyright (c) 2016 Microsoft. Tous droits réservés. 150 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contribute to this documentation 2 | 3 | Thank you for your interest in our documentation! 4 | 5 | * [Ways to contribute](#ways-to-contribute) 6 | * [Contribute using GitHub](#contribute-using-github) 7 | * [Contribute using Git](#contribute-using-git) 8 | * [How to use Markdown to format your topic](#how-to-use-markdown-to-format-your-topic) 9 | * [FAQ](#faq) 10 | * [More resources](#more-resources) 11 | 12 | ## Ways to contribute 13 | 14 | Here are some ways you can contribute to this documentation: 15 | 16 | * To make small changes to an article, [Contribute using GitHub](#contribute-using-github). 17 | * To make large changes, or changes that involve code, [Contribute using Git](#contribute-using-git). 18 | * Report documentation bugs via GitHub Issues 19 | * Request new documentation at the [Office Developer Platform UserVoice](http://officespdev.uservoice.com) site. 20 | 21 | ## Contribute using GitHub 22 | 23 | Use GitHub to contribute to this documentation without having to clone the repo to your desktop. This is the easiest way to create a pull request in this repository. Use this method to make a minor change that doesn't involve code changes. 24 | 25 | **Note** Using this method allows you to contribute to one article at a time. 26 | 27 | ### To Contribute using GitHub 28 | 29 | 1. Find the article you want to contribute to on GitHub. 30 | 31 | If the article is in MSDN, choose the **suggest and submit changes** link in the **Contribute to this content** section and you'll be taken to the same article on GitHub. 32 | 2. Once you are on the article in GitHub, sign in to GitHub (get a free account [Join GitHub](https://github.com/join). 33 | 3. Choose the **pencil icon** (edit the file in your fork of this project) and make your changes in the **<>Edit file** window. 34 | 4. Scroll to the bottom and enter a description. 35 | 5. Choose **Propose file change**>**Create pull request**. 36 | 37 | You now have successfully submitted a pull request. Pull requests are typically reviewed within 10 business days. 38 | 39 | 40 | ## Contribute using Git 41 | 42 | Use Git to contribute substantive changes, such as: 43 | 44 | * Contributing code. 45 | * Contributing changes that affect meaning. 46 | * Contributing large changes to text. 47 | * Adding new topics. 48 | 49 | ### To Contribute using Git 50 | 51 | 1. If you don't have a GitHub account, set one up at [GitHub](https://github.com/join). 52 | 2. After you have an account, install Git on your computer. Follow the steps in [Setting up Git Tutorial](https://help.github.com/articles/set-up-git/). 53 | 3. To submit a pull request using Git, follow the steps in [Use GitHub, Git, and this repository](#use-github-git-and-this-repository). 54 | 4. You will be asked to sign the Contributor's License Agreement if you are: 55 | 56 | * A member of the Microsoft Open Technologies group. 57 | * A contributors who doesn't work for Microsoft. 58 | 59 | As a community member, you must sign the Contribution License Agreement (CLA) before you can contribute large submissions to a project. You only need to complete and submit the documentation once. Carefully review the document. You may be required to have your employer sign the document. 60 | 61 | Signing the CLA does not grant you rights to commit to the main repository, but it does mean that the Office Developer and Office Developer Content Publishing teams will be able to review and approve your contributions. You will be credited for your submissions. 62 | 63 | Pull requests are typically reviewed within 10 business days. 64 | 65 | ## Use GitHub, Git, and this repository 66 | 67 | **Note:** Most of the information in this section can be found in [GitHub Help] articles. If you're familiar with Git and GitHub, skip to the **Contribute and edit content** section for the specifics of the code/content flow of this repository. 68 | 69 | ### To set up your fork of the repository 70 | 71 | 1. Set up a GitHub account so you can contribute to this project. If you haven't done this, go to [GitHub](https://github.com/join) and do it now. 72 | 2. Install Git on your computer. Follow the steps in the [Setting up Git Tutorial] [Set Up Git]. 73 | 3. Create your own fork of this repository. To do this, at the top of the page, choose the **Fork** button. 74 | 4. Copy your fork to your computer. To do this, open Git Bash. At the command prompt enter: 75 | 76 | git clone https://github.com//.git 77 | 78 | Next, create a reference to the root repository by entering these commands: 79 | 80 | cd 81 | git remote add upstream https://github.com/microsoftgraph/.git 82 | git fetch upstream 83 | 84 | Congratulations! You've now set up your repository. You won't need to repeat these steps again. 85 | 86 | ### Contribute and edit content 87 | 88 | To make the contribution process as seamless as possible, follow these steps. 89 | 90 | #### To contribute and edit content 91 | 92 | 1. Create a new branch. 93 | 2. Add new content or edit existing content. 94 | 3. Submit a pull request to the main repository. 95 | 4. Delete the branch. 96 | 97 | **Important** Limit each branch to a single concept/article to streamline the work flow and reduce the chance of merge conflicts. Content appropriate for a new branch includes: 98 | 99 | * A new article. 100 | * Spelling and grammar edits. 101 | * Applying a single formatting change across a large set of articles (for example, applying a new copyright footer). 102 | 103 | #### To create a new branch 104 | 105 | 1. Open Git Bash. 106 | 2. At the Git Bash command prompt, type `git pull upstream master:`. This creates a new branch locally that is copied from the latest MicrosoftGraph master branch. 107 | 3. At the Git Bash command prompt, type `git push origin `. This alerts GitHub to the new branch. You should now see the new branch in your fork of the repository on GitHub. 108 | 4. At the Git Bash command prompt, type `git checkout ` to switch to your new branch. 109 | 110 | #### Add new content or edit existing content 111 | 112 | You navigate to the repository on your computer by using File Explorer. The repository files are in `C:\Users\\`. 113 | 114 | To edit files, open them in an editor of your choice and modify them. To create a new file, use the editor of your choice and save the new file in the appropriate location in your local copy of the repository. While working, save your work frequently. 115 | 116 | The files in `C:\Users\\` are a working copy of the new branch that you created in your local repository. Changing anything in this folder doesn't affect the local repository until you commit a change. To commit a change to the local repository, type the following commands in GitBash: 117 | 118 | git add . 119 | git commit -v -a -m "" 120 | 121 | The `add` command adds your changes to a staging area in preparation for committing them to the repository. The period after the `add` command specifies that you want to stage all of the files that you added or modified, checking subfolders recursively. (If you don't want to commit all of the changes, you can add specific files. You can also undo a commit. For help, type `git add -help` or `git status`.) 122 | 123 | The `commit` command applies the staged changes to the repository. The switch `-m` means you are providing the commit comment in the command line. The -v and -a switches can be omitted. The -v switch is for verbose output from the command, and -a does what you already did with the add command. 124 | 125 | You can commit multiple times while you are doing your work, or you can commit once when you're done. 126 | 127 | #### Submit a pull request to the main repository 128 | 129 | When you're finished with your work and are ready to have it merged into the main repository, follow these steps. 130 | 131 | #### To submit a pull request to the main repository 132 | 133 | 1. In the Git Bash command prompt, type `git push origin `. In your local repository, `origin` refers to your GitHub repository that you cloned the local repository from. This command pushes the current state of your new branch, including all commits made in the previous steps, to your GitHub fork. 134 | 2. On the GitHub site, navigate in your fork to the new branch. 135 | 3. Choose the **Pull Request** button at the top of the page. 136 | 4. Verify the Base branch is `microsoftgraph/@master` and the Head branch is `/@`. 137 | 5. Choose the **Update Commit Range** button. 138 | 6. Add a title to your pull request, and describe all the changes you're making. 139 | 7. Submit the pull request. 140 | 141 | One of the site administrators will process your pull request. Your pull request will surface on the microsoftgraph/ site under Issues. When the pull request is accepted, the issue will be resolved. 142 | 143 | #### Create a new branch after merge 144 | 145 | After a branch is successfully merged (that is, your pull request is accepted), don't continue working in that local branch. This can lead to merge conflicts if you submit another pull request. To do another update, create a new local branch from the successfully merged upstream branch, and then delete your initial local branch. 146 | 147 | For example, if your local branch X was successfully merged into the OfficeDev/microsoft-graph-docs master branch and you want to make additional updates to the content that was merged. Create a new local branch, X2, from the OfficeDev/microsoft-graph-docs master branch. To do this, open GitBash and execute the following commands: 148 | 149 | cd microsoft-graph-docs 150 | git pull upstream master:X2 151 | git push origin X2 152 | 153 | You now have local copies (in a new local branch) of the work that you submitted in branch X. The X2 branch also contains all the work other writers have merged, so if your work depends on others' work (for example, shared images), it is available in the new branch. You can verify that your previous work (and others' work) is in the branch by checking out the new branch... 154 | 155 | git checkout X2 156 | 157 | ...and verifying the content. (The `checkout` command updates the files in `C:\Users\\microsoft-graph-docs` to the current state of the X2 branch.) Once you check out the new branch, you can make updates to the content and commit them as usual. However, to avoid working in the merged branch (X) by mistake, it's best to delete it (see the following **Delete a branch** section). 158 | 159 | #### Delete a branch 160 | 161 | Once your changes are successfully merged into the main repository, delete the branch you used because you no longer need it. Any additional work should be done in a new branch. 162 | 163 | #### To delete a branch 164 | 165 | 1. In the Git Bash command prompt, type `git checkout master`. This ensures that you aren't in the branch to be deleted (which isn't allowed). 166 | 2. Next, at the command prompt, type `git branch -d `. This deletes the branch on your computer only if it has been successfully merged to the upstream repository. (You can override this behavior with the `–D` flag, but first be sure you want to do this.) 167 | 3. Finally, type `git push origin :` at the command prompt (a space before the colon and no space after it). This will delete the branch on your github fork. 168 | 169 | Congratulations, you have successfully contributed to the project! 170 | 171 | ## How to use Markdown to format your topic 172 | 173 | ### Article template 174 | 175 | The [markdown template](/articles/0-markdown-template-for-new-articles.md) contains the basic Markdown for a topic that includes a table of contents, sections with subheadings, links to other Office developer topics, links to other sites, bold text, italic text, numbered and bulleted lists, code snippets, and images. 176 | 177 | 178 | ### Standard Markdown 179 | 180 | All of the articles in this repository use Markdown. A complete introduction (and listing of all the syntax) can be found at [Markdown Home] []. 181 | 182 | ## FAQ 183 | 184 | ### How do I get a GitHub account? 185 | 186 | Fill out the form at [Join GitHub](https://github.com/join) to open a free GitHub account. 187 | 188 | ### Where do I get a Contributor's License Agreement? 189 | 190 | You will automatically be sent a notice that you need to sign the Contributor's License Agreement (CLA) if your pull request requires one. 191 | 192 | As a community member, **you must sign the Contribution License Agreement (CLA) before you can contribute large submissions to this project**. You only need complete and submit the documentation once. Carefully review the document. You may be required to have your employer sign the document. 193 | 194 | ### What happens with my contributions? 195 | 196 | When you submit your changes, via a pull request, our team will be notified and will review your pull request. You will receive notifications about your pull request from GitHub; you may also be notified by someone from our team if we need more information. We reserve the right to edit your submission for legal, style, clarity, or other issues. 197 | 198 | ### Can I become an approver for this repository's GitHub pull requests? 199 | 200 | Currently, we are not allowing external contributors to approve pull requests in this repository. 201 | 202 | ### How soon will I get a response about my change request or issue? 203 | 204 | We typically review pull requests and respond to issues within 10 business days. 205 | 206 | ## More resources 207 | 208 | * To learn more about Markdown, go to the Git creator's site [Daring Fireball]. 209 | * To learn more about using Git and GitHub, first check out the [GitHub Help section] [GitHub Help]. 210 | 211 | [GitHub Home]: http://github.com 212 | [GitHub Help]: http://help.github.com/ 213 | [Set Up Git]: http://help.github.com/win-set-up-git/ 214 | [Markdown Home]: http://daringfireball.net/projects/markdown/ 215 | [Daring Fireball]: http://daringfireball.net/ 216 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 62F2DB1426201FA52AB6E2D0 /* libPods-iOS-objectivec-snippets-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EC0E24CC77675B772252B6BA /* libPods-iOS-objectivec-snippets-sample.a */; }; 11 | D3045CCC1CDA6142002ED490 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D3045CCB1CDA6142002ED490 /* main.m */; }; 12 | D3045CCF1CDA6142002ED490 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D3045CCE1CDA6142002ED490 /* AppDelegate.m */; }; 13 | D3045CD21CDA6142002ED490 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3045CD11CDA6142002ED490 /* MasterViewController.m */; }; 14 | D3045CD51CDA6142002ED490 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3045CD41CDA6142002ED490 /* DetailViewController.m */; }; 15 | D3045CDA1CDA6142002ED490 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D3045CD91CDA6142002ED490 /* Assets.xcassets */; }; 16 | D3045CDD1CDA6142002ED490 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3045CDB1CDA6142002ED490 /* LaunchScreen.storyboard */; }; 17 | D34874431CECE1F000C935D0 /* EmailBody.html in Resources */ = {isa = PBXBuildFile; fileRef = D34874421CECE1F000C935D0 /* EmailBody.html */; }; 18 | D3FBFEF31CE64AEA00727130 /* SnippetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FBFEF21CE64AEA00727130 /* SnippetInfo.m */; }; 19 | D3FBFEF61CE64D3500727130 /* Snippets.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FBFEF51CE64D3500727130 /* Snippets.m */; }; 20 | D3FBFEF91CEA3FAC00727130 /* AuthenticationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FBFEF81CEA3FAC00727130 /* AuthenticationConstants.m */; }; 21 | D3FBFEFC1CEA3FB600727130 /* Authentication.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FBFEFB1CEA3FB600727130 /* Authentication.m */; }; 22 | D3FBFEFF1CEA860A00727130 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3FBFEFD1CEA860A00727130 /* Main.storyboard */; }; 23 | D3FBFF021CEA86D500727130 /* ConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FBFF011CEA86D500727130 /* ConnectViewController.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 199BEE758AC6B36D7A6DB3E3 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 28 | 38D3275A60179A29C2090B9E /* Pods-iOS-objectivec-snippets-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS-objectivec-snippets-sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-iOS-objectivec-snippets-sample/Pods-iOS-objectivec-snippets-sample.release.xcconfig"; sourceTree = ""; }; 29 | 4410821193404FBADEC20629 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 547BA2EB1041D43C4426C96D /* Pods-iOS-objectivec-snippets-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS-objectivec-snippets-sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iOS-objectivec-snippets-sample/Pods-iOS-objectivec-snippets-sample.debug.xcconfig"; sourceTree = ""; }; 31 | D0E4321A2FE03960894D9E3F /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 32 | D3045CC71CDA6142002ED490 /* iOS-objectivec-snippets-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS-objectivec-snippets-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | D3045CCB1CDA6142002ED490 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | D3045CCD1CDA6142002ED490 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | D3045CCE1CDA6142002ED490 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | D3045CD01CDA6142002ED490 /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; 37 | D3045CD11CDA6142002ED490 /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; 38 | D3045CD31CDA6142002ED490 /* DetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; 39 | D3045CD41CDA6142002ED490 /* DetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; 40 | D3045CD91CDA6142002ED490 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 41 | D3045CDC1CDA6142002ED490 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 42 | D3045CDE1CDA6142002ED490 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | D34874421CECE1F000C935D0 /* EmailBody.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = EmailBody.html; sourceTree = ""; }; 44 | D3FBFEF11CE64AEA00727130 /* SnippetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetInfo.h; sourceTree = ""; }; 45 | D3FBFEF21CE64AEA00727130 /* SnippetInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SnippetInfo.m; sourceTree = ""; }; 46 | D3FBFEF41CE64D3500727130 /* Snippets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Snippets.h; sourceTree = ""; }; 47 | D3FBFEF51CE64D3500727130 /* Snippets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Snippets.m; sourceTree = ""; }; 48 | D3FBFEF71CEA3FA200727130 /* AuthenticationConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticationConstants.h; sourceTree = ""; }; 49 | D3FBFEF81CEA3FAC00727130 /* AuthenticationConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthenticationConstants.m; sourceTree = ""; }; 50 | D3FBFEFA1CEA3FB600727130 /* Authentication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Authentication.h; sourceTree = ""; }; 51 | D3FBFEFB1CEA3FB600727130 /* Authentication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Authentication.m; sourceTree = ""; }; 52 | D3FBFEFE1CEA860A00727130 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | D3FBFF001CEA86D500727130 /* ConnectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectViewController.h; sourceTree = ""; }; 54 | D3FBFF011CEA86D500727130 /* ConnectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConnectViewController.m; sourceTree = ""; }; 55 | EC0E24CC77675B772252B6BA /* libPods-iOS-objectivec-snippets-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-iOS-objectivec-snippets-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | D3045CC41CDA6142002ED490 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 62F2DB1426201FA52AB6E2D0 /* libPods-iOS-objectivec-snippets-sample.a in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 11834EEB5196267F8A3C305E /* Frameworks */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 4410821193404FBADEC20629 /* libPods.a */, 74 | EC0E24CC77675B772252B6BA /* libPods-iOS-objectivec-snippets-sample.a */, 75 | ); 76 | name = Frameworks; 77 | sourceTree = ""; 78 | }; 79 | 701E71F78235E3DC89E536C0 /* Pods */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 199BEE758AC6B36D7A6DB3E3 /* Pods.debug.xcconfig */, 83 | D0E4321A2FE03960894D9E3F /* Pods.release.xcconfig */, 84 | 547BA2EB1041D43C4426C96D /* Pods-iOS-objectivec-snippets-sample.debug.xcconfig */, 85 | 38D3275A60179A29C2090B9E /* Pods-iOS-objectivec-snippets-sample.release.xcconfig */, 86 | ); 87 | name = Pods; 88 | sourceTree = ""; 89 | }; 90 | D3045CBE1CDA6142002ED490 = { 91 | isa = PBXGroup; 92 | children = ( 93 | D3045CC91CDA6142002ED490 /* iOS-objectivec-snippets-sample */, 94 | D3045CC81CDA6142002ED490 /* Products */, 95 | 701E71F78235E3DC89E536C0 /* Pods */, 96 | 11834EEB5196267F8A3C305E /* Frameworks */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | D3045CC81CDA6142002ED490 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | D3045CC71CDA6142002ED490 /* iOS-objectivec-snippets-sample.app */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | D3045CC91CDA6142002ED490 /* iOS-objectivec-snippets-sample */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | D3FBFF091CEB984F00727130 /* Controllers */, 112 | D3FBFF0A1CEBB66B00727130 /* Snippet Library */, 113 | D3FBFF081CEB983A00727130 /* Authentication */, 114 | D34874411CECE1B800C935D0 /* Resources */, 115 | D3FBFEFD1CEA860A00727130 /* Main.storyboard */, 116 | D3045CDB1CDA6142002ED490 /* LaunchScreen.storyboard */, 117 | D3045CCA1CDA6142002ED490 /* Supporting Files */, 118 | ); 119 | path = "iOS-objectivec-snippets-sample"; 120 | sourceTree = ""; 121 | }; 122 | D3045CCA1CDA6142002ED490 /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | D3045CCB1CDA6142002ED490 /* main.m */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | D34874411CECE1B800C935D0 /* Resources */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | D3045CDE1CDA6142002ED490 /* Info.plist */, 134 | D3045CD91CDA6142002ED490 /* Assets.xcassets */, 135 | D34874421CECE1F000C935D0 /* EmailBody.html */, 136 | ); 137 | name = Resources; 138 | sourceTree = ""; 139 | }; 140 | D3FBFF081CEB983A00727130 /* Authentication */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | D3FBFEF71CEA3FA200727130 /* AuthenticationConstants.h */, 144 | D3FBFEF81CEA3FAC00727130 /* AuthenticationConstants.m */, 145 | D3FBFEFA1CEA3FB600727130 /* Authentication.h */, 146 | D3FBFEFB1CEA3FB600727130 /* Authentication.m */, 147 | ); 148 | name = Authentication; 149 | sourceTree = ""; 150 | }; 151 | D3FBFF091CEB984F00727130 /* Controllers */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | D3FBFF001CEA86D500727130 /* ConnectViewController.h */, 155 | D3FBFF011CEA86D500727130 /* ConnectViewController.m */, 156 | D3045CD01CDA6142002ED490 /* MasterViewController.h */, 157 | D3045CD11CDA6142002ED490 /* MasterViewController.m */, 158 | D3045CD31CDA6142002ED490 /* DetailViewController.h */, 159 | D3045CD41CDA6142002ED490 /* DetailViewController.m */, 160 | D3045CCD1CDA6142002ED490 /* AppDelegate.h */, 161 | D3045CCE1CDA6142002ED490 /* AppDelegate.m */, 162 | ); 163 | name = Controllers; 164 | sourceTree = ""; 165 | }; 166 | D3FBFF0A1CEBB66B00727130 /* Snippet Library */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | D3FBFEF11CE64AEA00727130 /* SnippetInfo.h */, 170 | D3FBFEF21CE64AEA00727130 /* SnippetInfo.m */, 171 | D3FBFEF41CE64D3500727130 /* Snippets.h */, 172 | D3FBFEF51CE64D3500727130 /* Snippets.m */, 173 | ); 174 | name = "Snippet Library"; 175 | sourceTree = ""; 176 | }; 177 | /* End PBXGroup section */ 178 | 179 | /* Begin PBXNativeTarget section */ 180 | D3045CC61CDA6142002ED490 /* iOS-objectivec-snippets-sample */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = D3045CE11CDA6142002ED490 /* Build configuration list for PBXNativeTarget "iOS-objectivec-snippets-sample" */; 183 | buildPhases = ( 184 | 1307105058CE3CAE78EC62D2 /* [CP] Check Pods Manifest.lock */, 185 | D3045CC31CDA6142002ED490 /* Sources */, 186 | D3045CC41CDA6142002ED490 /* Frameworks */, 187 | D3045CC51CDA6142002ED490 /* Resources */, 188 | D3E8E306B532702599F3EDF1 /* [CP] Embed Pods Frameworks */, 189 | ED6C90A7A71E101E16F3A620 /* [CP] Copy Pods Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | ); 195 | name = "iOS-objectivec-snippets-sample"; 196 | productName = "iOS-objectivec-snippets-sample"; 197 | productReference = D3045CC71CDA6142002ED490 /* iOS-objectivec-snippets-sample.app */; 198 | productType = "com.apple.product-type.application"; 199 | }; 200 | /* End PBXNativeTarget section */ 201 | 202 | /* Begin PBXProject section */ 203 | D3045CBF1CDA6142002ED490 /* Project object */ = { 204 | isa = PBXProject; 205 | attributes = { 206 | LastUpgradeCheck = 0720; 207 | ORGANIZATIONNAME = Microsoft; 208 | TargetAttributes = { 209 | D3045CC61CDA6142002ED490 = { 210 | CreatedOnToolsVersion = 7.2.1; 211 | }; 212 | }; 213 | }; 214 | buildConfigurationList = D3045CC21CDA6142002ED490 /* Build configuration list for PBXProject "iOS-objectivec-snippets-sample" */; 215 | compatibilityVersion = "Xcode 3.2"; 216 | developmentRegion = English; 217 | hasScannedForEncodings = 0; 218 | knownRegions = ( 219 | en, 220 | Base, 221 | ); 222 | mainGroup = D3045CBE1CDA6142002ED490; 223 | productRefGroup = D3045CC81CDA6142002ED490 /* Products */; 224 | projectDirPath = ""; 225 | projectRoot = ""; 226 | targets = ( 227 | D3045CC61CDA6142002ED490 /* iOS-objectivec-snippets-sample */, 228 | ); 229 | }; 230 | /* End PBXProject section */ 231 | 232 | /* Begin PBXResourcesBuildPhase section */ 233 | D3045CC51CDA6142002ED490 /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | D3FBFEFF1CEA860A00727130 /* Main.storyboard in Resources */, 238 | D3045CDD1CDA6142002ED490 /* LaunchScreen.storyboard in Resources */, 239 | D3045CDA1CDA6142002ED490 /* Assets.xcassets in Resources */, 240 | D34874431CECE1F000C935D0 /* EmailBody.html in Resources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXResourcesBuildPhase section */ 245 | 246 | /* Begin PBXShellScriptBuildPhase section */ 247 | 1307105058CE3CAE78EC62D2 /* [CP] Check Pods Manifest.lock */ = { 248 | isa = PBXShellScriptBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | inputPaths = ( 253 | ); 254 | name = "[CP] Check Pods Manifest.lock"; 255 | outputPaths = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | shellPath = /bin/sh; 259 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 260 | showEnvVarsInLog = 0; 261 | }; 262 | D3E8E306B532702599F3EDF1 /* [CP] Embed Pods Frameworks */ = { 263 | isa = PBXShellScriptBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | ); 267 | inputPaths = ( 268 | ); 269 | name = "[CP] Embed Pods Frameworks"; 270 | outputPaths = ( 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | shellPath = /bin/sh; 274 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOS-objectivec-snippets-sample/Pods-iOS-objectivec-snippets-sample-frameworks.sh\"\n"; 275 | showEnvVarsInLog = 0; 276 | }; 277 | ED6C90A7A71E101E16F3A620 /* [CP] Copy Pods Resources */ = { 278 | isa = PBXShellScriptBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | ); 282 | inputPaths = ( 283 | ); 284 | name = "[CP] Copy Pods Resources"; 285 | outputPaths = ( 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | shellPath = /bin/sh; 289 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOS-objectivec-snippets-sample/Pods-iOS-objectivec-snippets-sample-resources.sh\"\n"; 290 | showEnvVarsInLog = 0; 291 | }; 292 | /* End PBXShellScriptBuildPhase section */ 293 | 294 | /* Begin PBXSourcesBuildPhase section */ 295 | D3045CC31CDA6142002ED490 /* Sources */ = { 296 | isa = PBXSourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | D3045CCF1CDA6142002ED490 /* AppDelegate.m in Sources */, 300 | D3045CD21CDA6142002ED490 /* MasterViewController.m in Sources */, 301 | D3FBFEF61CE64D3500727130 /* Snippets.m in Sources */, 302 | D3045CCC1CDA6142002ED490 /* main.m in Sources */, 303 | D3FBFF021CEA86D500727130 /* ConnectViewController.m in Sources */, 304 | D3FBFEF91CEA3FAC00727130 /* AuthenticationConstants.m in Sources */, 305 | D3FBFEF31CE64AEA00727130 /* SnippetInfo.m in Sources */, 306 | D3FBFEFC1CEA3FB600727130 /* Authentication.m in Sources */, 307 | D3045CD51CDA6142002ED490 /* DetailViewController.m in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | /* End PBXSourcesBuildPhase section */ 312 | 313 | /* Begin PBXVariantGroup section */ 314 | D3045CDB1CDA6142002ED490 /* LaunchScreen.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | D3045CDC1CDA6142002ED490 /* Base */, 318 | ); 319 | name = LaunchScreen.storyboard; 320 | sourceTree = ""; 321 | }; 322 | D3FBFEFD1CEA860A00727130 /* Main.storyboard */ = { 323 | isa = PBXVariantGroup; 324 | children = ( 325 | D3FBFEFE1CEA860A00727130 /* Base */, 326 | ); 327 | name = Main.storyboard; 328 | sourceTree = ""; 329 | }; 330 | /* End PBXVariantGroup section */ 331 | 332 | /* Begin XCBuildConfiguration section */ 333 | D3045CDF1CDA6142002ED490 /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BOOL_CONVERSION = YES; 342 | CLANG_WARN_CONSTANT_CONVERSION = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_EMPTY_BODY = YES; 345 | CLANG_WARN_ENUM_CONVERSION = YES; 346 | CLANG_WARN_INT_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 351 | COPY_PHASE_STRIP = NO; 352 | DEBUG_INFORMATION_FORMAT = dwarf; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | ENABLE_TESTABILITY = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu99; 356 | GCC_DYNAMIC_NO_PIC = NO; 357 | GCC_NO_COMMON_BLOCKS = YES; 358 | GCC_OPTIMIZATION_LEVEL = 0; 359 | GCC_PREPROCESSOR_DEFINITIONS = ( 360 | "DEBUG=1", 361 | "$(inherited)", 362 | ); 363 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 364 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 365 | GCC_WARN_UNDECLARED_SELECTOR = YES; 366 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 367 | GCC_WARN_UNUSED_FUNCTION = YES; 368 | GCC_WARN_UNUSED_VARIABLE = YES; 369 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 370 | MTL_ENABLE_DEBUG_INFO = YES; 371 | ONLY_ACTIVE_ARCH = YES; 372 | SDKROOT = iphoneos; 373 | }; 374 | name = Debug; 375 | }; 376 | D3045CE01CDA6142002ED490 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 396 | ENABLE_NS_ASSERTIONS = NO; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 407 | MTL_ENABLE_DEBUG_INFO = NO; 408 | SDKROOT = iphoneos; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | D3045CE21CDA6142002ED490 /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | baseConfigurationReference = 547BA2EB1041D43C4426C96D /* Pods-iOS-objectivec-snippets-sample.debug.xcconfig */; 416 | buildSettings = { 417 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 418 | INFOPLIST_FILE = "iOS-objectivec-snippets-sample/Info.plist"; 419 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 420 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.iOS-objectivec-snippets-sample"; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | }; 424 | name = Debug; 425 | }; 426 | D3045CE31CDA6142002ED490 /* Release */ = { 427 | isa = XCBuildConfiguration; 428 | baseConfigurationReference = 38D3275A60179A29C2090B9E /* Pods-iOS-objectivec-snippets-sample.release.xcconfig */; 429 | buildSettings = { 430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 431 | INFOPLIST_FILE = "iOS-objectivec-snippets-sample/Info.plist"; 432 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 433 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.iOS-objectivec-snippets-sample"; 434 | PRODUCT_NAME = "$(TARGET_NAME)"; 435 | TARGETED_DEVICE_FAMILY = "1,2"; 436 | }; 437 | name = Release; 438 | }; 439 | /* End XCBuildConfiguration section */ 440 | 441 | /* Begin XCConfigurationList section */ 442 | D3045CC21CDA6142002ED490 /* Build configuration list for PBXProject "iOS-objectivec-snippets-sample" */ = { 443 | isa = XCConfigurationList; 444 | buildConfigurations = ( 445 | D3045CDF1CDA6142002ED490 /* Debug */, 446 | D3045CE01CDA6142002ED490 /* Release */, 447 | ); 448 | defaultConfigurationIsVisible = 0; 449 | defaultConfigurationName = Release; 450 | }; 451 | D3045CE11CDA6142002ED490 /* Build configuration list for PBXNativeTarget "iOS-objectivec-snippets-sample" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | D3045CE21CDA6142002ED490 /* Debug */, 455 | D3045CE31CDA6142002ED490 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | /* End XCConfigurationList section */ 461 | }; 462 | rootObject = D3045CBF1CDA6142002ED490 /* Project object */; 463 | } 464 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 180 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | -------------------------------------------------------------------------------- /iOS-objectivec-snippets-sample/Snippets.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import "Authentication.h" 7 | #import "MasterViewController.h" 8 | #import "SnippetInfo.h" 9 | #import "Snippets.h" 10 | #import 11 | 12 | 13 | @interface Snippets() 14 | 15 | @property (strong, nonatomic) MSGraphClient *graphClient; 16 | @property (strong, nonatomic) NSString *emailAddress; 17 | @property (strong, nonatomic) NSString *displayName; 18 | 19 | @end 20 | 21 | @implementation Snippets 22 | 23 | - (instancetype)init { 24 | self = [super init]; 25 | if (self){ 26 | [self initializeSnippetGroups]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)setGraphClientWithAuthProvider:(id)provider { 32 | [MSGraphClient setAuthenticationProvider:provider]; 33 | self.graphClient = [MSGraphClient client]; 34 | 35 | //Helper method for retrieving some user info to assist with some of the snippet cases. 36 | [self getUserInfo]; 37 | } 38 | 39 | 40 | 41 | 42 | - (void)initializeSnippetGroups { 43 | NSMutableArray *snippetGroups = [NSMutableArray new]; 44 | NSMutableArray *snippetGroupNames = [NSMutableArray new]; 45 | 46 | NSArray *userSection = @[[[SnippetInfo alloc] initWithName:@"Get me" needsAdmin:NO action:@selector(getMe)], 47 | [[SnippetInfo alloc] initWithName:@"Get users" needsAdmin:NO action:@selector(getUsers)], 48 | [[SnippetInfo alloc] initWithName:@"Get drive" needsAdmin:NO action:@selector(getDrive)], 49 | [[SnippetInfo alloc] initWithName:@"Get events" needsAdmin:NO action:@selector(getEvents)], 50 | [[SnippetInfo alloc] initWithName:@"Create event" needsAdmin:NO action:@selector(createEvent)], 51 | [[SnippetInfo alloc] initWithName:@"Update event" needsAdmin:NO action:@selector(updateEvent)], 52 | [[SnippetInfo alloc] initWithName:@"Delete event" needsAdmin:NO action:@selector(deleteEvent)], 53 | [[SnippetInfo alloc] initWithName:@"Get messages" needsAdmin:NO action:@selector(getMessages)], 54 | [[SnippetInfo alloc] initWithName:@"Send message" needsAdmin:NO action:@selector(sendMessage)], 55 | [[SnippetInfo alloc] initWithName:@"Get user files" needsAdmin:NO action:@selector(getUserFiles)], 56 | [[SnippetInfo alloc] initWithName:@"Create text file" needsAdmin:NO action:@selector(createTextFile)], 57 | [[SnippetInfo alloc] initWithName:@"Create folder" needsAdmin:NO action:@selector(createFolder)], 58 | [[SnippetInfo alloc] initWithName:@"Download file" needsAdmin:NO action:@selector(downloadFile)], 59 | [[SnippetInfo alloc] initWithName:@"Update file" needsAdmin:NO action:@selector(updateFile)], 60 | [[SnippetInfo alloc] initWithName:@"Rename file" needsAdmin:NO action:@selector(renameFile)], 61 | [[SnippetInfo alloc] initWithName:@"Delete file" needsAdmin:NO action:@selector(deleteFile)], 62 | [[SnippetInfo alloc] initWithName:@"Get manager" needsAdmin:NO action:@selector(getManager)], 63 | [[SnippetInfo alloc] initWithName:@"Get directs" needsAdmin:NO action:@selector(getDirects)], 64 | [[SnippetInfo alloc] initWithName:@"Get photo" needsAdmin:NO action:@selector(getPhoto)], 65 | [[SnippetInfo alloc] initWithName:@"Create user" needsAdmin:NO action:@selector(createUser)], 66 | [[SnippetInfo alloc] initWithName:@"Get user groups" needsAdmin:NO action:@selector(getUserGroups)]]; 67 | 68 | NSArray *groupsSection = @[[[SnippetInfo alloc] initWithName:@"Get all groups" needsAdmin:YES action:@selector(getAllGroups)], 69 | [[SnippetInfo alloc] initWithName:@"Get single group"needsAdmin:YES action:@selector(getSingleGroup)], 70 | [[SnippetInfo alloc] initWithName:@"Get members" needsAdmin:YES action:@selector(getMembers)], 71 | [[SnippetInfo alloc] initWithName:@"Get owners" needsAdmin:YES action:@selector(getOwners)], 72 | [[SnippetInfo alloc] initWithName:@"Create group" needsAdmin:YES action:@selector(createGroup)], 73 | [[SnippetInfo alloc] initWithName:@"Update group" needsAdmin:YES action:@selector(updateGroup)], 74 | [[SnippetInfo alloc] initWithName:@"Delete group" needsAdmin:YES action:@selector(deleteGroup)]]; 75 | 76 | [snippetGroups addObject:userSection]; 77 | [snippetGroupNames addObject:@"Users"]; 78 | [snippetGroups addObject:groupsSection]; 79 | [snippetGroupNames addObject:@"Groups"]; 80 | 81 | _snippetGroups = [NSArray arrayWithArray:snippetGroups]; 82 | _snippetGroupNames = [NSArray arrayWithArray:snippetGroupNames]; 83 | } 84 | 85 | 86 | #pragma mark - Snippets - Users 87 | 88 | // Returns select information about the signed-in user from Azure Active Directory. Applies to personal or work accounts 89 | - (void)getMe { 90 | [[[self.graphClient me] request] getWithCompletion:^(MSGraphUser *response, NSError *error) { 91 | if (error) { 92 | [self.delegate snippetFailure:error]; 93 | } 94 | else { 95 | NSString *responseString = [NSString stringWithFormat:@"Retrieval of account information succeeded for %@", response.displayName]; 96 | [self.delegate snippetSuccess:responseString]; 97 | } 98 | }]; 99 | } 100 | 101 | 102 | // Returns all of the users in your tenant's directory. to personal or work accounts 103 | - (void)getUsers { 104 | [[[self.graphClient users] request] getWithCompletion:^(MSCollection *response, MSGraphUsersCollectionRequest *nextRequest, NSError *error) { 105 | if (error) { 106 | [self.delegate snippetFailure:error]; 107 | } 108 | else { 109 | NSMutableString *responseString = [NSMutableString stringWithString:@"List of users:\n"]; 110 | for(MSGraphUser *user in response.value){ 111 | [responseString appendFormat:@"%@ \n", user.displayName]; 112 | } 113 | [self.delegate snippetSuccess:responseString]; 114 | } 115 | }]; 116 | } 117 | 118 | 119 | // Gets the signed-in user's drive from OneDrive. Applies to personal or work accounts 120 | - (void)getDrive { 121 | [[[[self.graphClient me] drive] request] getWithCompletion:^(MSGraphDrive *drive, NSError *error){ 122 | if (error) { 123 | [self.delegate snippetFailure:error]; 124 | } 125 | else { 126 | NSString *responseString = [NSString stringWithFormat:@"Drive information:\nDriveType is %@\nTotal quota is %lld", drive.driveType, drive.quota.total]; 127 | [self.delegate snippetSuccess:responseString]; 128 | } 129 | }]; 130 | } 131 | 132 | 133 | // Gets the signed-in user's events. Applies to personal or work accounts 134 | - (void)getEvents { 135 | [[[[self.graphClient me] events] request] getWithCompletion:^(MSCollection *response, MSGraphUserEventsCollectionRequest *nextRequest, NSError *error) { 136 | if (error) { 137 | [self.delegate snippetFailure:error]; 138 | } 139 | else { 140 | NSMutableString *responseString = [NSMutableString stringWithString:@"List of events:\n"]; 141 | for(MSGraphEvent *event in response.value){ 142 | [responseString appendFormat:@"%@ \n", event.subject]; 143 | } 144 | [self.delegate snippetSuccess:responseString]; 145 | } 146 | }]; 147 | } 148 | 149 | 150 | // Create an event in the signed in user's calendar. Applies to personal or work accounts. 151 | - (void)createEvent { 152 | //Creates a sample event and sends it to the logged in user 153 | MSGraphEvent *event = [self getEventObject]; 154 | 155 | [[[[self.graphClient me] events] request] addEvent:event withCompletion:^(MSGraphEvent *response, NSError *error) { 156 | if (error) { 157 | [self.delegate snippetFailure:error]; 158 | } 159 | else { 160 | NSString *responseString = [NSString stringWithFormat:@"Event created with id %@", response.entityId]; 161 | [self.delegate snippetSuccess:responseString]; 162 | } 163 | }]; 164 | } 165 | 166 | 167 | // Updates an event in the signed in user's calendar. Applies to personal or work accounts. 168 | - (void)updateEvent { 169 | //Creates a sample event and sends it to the logged in user 170 | [self createSampleEventwithCompletion:^(MSGraphEvent *event, NSError *error) { 171 | if (error) { 172 | [self.delegate snippetFailure:error]; 173 | } 174 | else { 175 | event.subject = @"Updated subject"; 176 | [[[[self.graphClient me] events:event.entityId] request] update:event withCompletion:^(MSGraphEvent *response, NSError *error) { 177 | if (error) { 178 | [self.delegate snippetFailure:error]; 179 | } 180 | else { 181 | NSString *responseString = @"Event updated with a new subject."; 182 | [self.delegate snippetSuccess:responseString]; 183 | } 184 | }]; 185 | } 186 | }]; 187 | } 188 | 189 | 190 | // Deletes an event in the signed in user's calendar. Applies to personal or work accounts. 191 | - (void)deleteEvent { 192 | //Creates a sample event and sends it to the logged in user 193 | [self createSampleEventwithCompletion:^(MSGraphEvent *event, NSError *error) { 194 | if (error) { 195 | [self.delegate snippetFailure:error]; 196 | } 197 | else { 198 | [[[[self.graphClient me] events:event.entityId] request] deleteWithCompletion:^(NSError *error) { 199 | if (error) { 200 | [self.delegate snippetFailure:error]; 201 | } 202 | else { 203 | NSString *responseString = [NSString stringWithFormat:@"Deleted calendar event id: %@", event.entityId]; 204 | [self.delegate snippetSuccess:responseString]; 205 | } 206 | }]; 207 | } 208 | }]; 209 | } 210 | 211 | 212 | // Gets the signed-in user's messages from Office 365. Applies to personal or work accounts 213 | - (void)getMessages { 214 | [[[[self.graphClient me] messages] request] getWithCompletion:^(MSCollection *response, MSGraphUserMessagesCollectionRequest *nextRequest, NSError *error) { 215 | if (error) { 216 | [self.delegate snippetFailure:error]; 217 | } 218 | else { 219 | NSMutableString *responseString = [NSMutableString stringWithString:@"List of messages:\n"]; 220 | for(MSGraphMessage *message in response.value){ 221 | [responseString appendFormat:@"%@ \n", message.subject]; 222 | } 223 | if (nextRequest) { 224 | [responseString appendFormat:@"Next request available for more messages"]; 225 | } 226 | [self.delegate snippetSuccess:responseString]; 227 | } 228 | }]; 229 | } 230 | 231 | 232 | // Create and send a message as the signed-in user. Applies to personal or work accounts 233 | - (void)sendMessage { 234 | MSGraphMessage *message = [self getSampleMessage]; 235 | MSGraphUserSendMailRequestBuilder *requestBuilder = [[self.graphClient me]sendMailWithMessage:message saveToSentItems:true]; 236 | 237 | MSGraphUserSendMailRequest *mailRequest = [requestBuilder request]; 238 | [mailRequest executeWithCompletion:^(NSDictionary *response, NSError *error) { 239 | if (error) { 240 | [self.delegate snippetFailure:error]; 241 | } 242 | else { 243 | NSString *responseString = @"Message sent."; 244 | [self.delegate snippetSuccess:responseString]; 245 | } 246 | }]; 247 | } 248 | 249 | 250 | // Returns all of the user's files. Applies to personal or work accounts 251 | - (void)getUserFiles { 252 | [[[[[[self.graphClient me]drive]root]children]request]getWithCompletion:^(MSCollection *response, MSGraphDriveItemChildrenCollectionRequest *nextRequest, NSError *error) { 253 | if (error) { 254 | [self.delegate snippetFailure:error]; 255 | } 256 | else { 257 | NSMutableString *responseString = [NSMutableString stringWithString:@"List of files:\n"]; 258 | for(MSGraphDriveItem *file in response.value){ 259 | [responseString appendFormat:@"%@: %lld \n", file.name, file.size]; 260 | } 261 | 262 | if (nextRequest ) { 263 | [responseString appendFormat:@"Next request available for more files."]; 264 | } 265 | [self.delegate snippetSuccess:responseString]; 266 | } 267 | }]; 268 | } 269 | 270 | 271 | // Create a text file in the signed in user's OneDrive account- If a file already exists it will be overwritten. Applies to personal or work accounts 272 | - (void)createTextFile { 273 | NSString *testFile = [[NSString alloc]init]; 274 | NSData *uploadData = [testFile dataUsingEncoding:NSUTF8StringEncoding]; 275 | [[[[[[self.graphClient me] drive] root] itemByPath:@"Test Folder/testTextFile.text"] contentRequest] uploadFromData:uploadData completion:^(MSGraphDriveItem *response, NSError *error) { 276 | if (error) { 277 | [self.delegate snippetFailure:error]; 278 | } 279 | else { 280 | NSString *responseString = @"File created at Test Folder/testTextFile.text"; 281 | [self.delegate snippetSuccess:responseString]; 282 | } 283 | }]; 284 | } 285 | 286 | 287 | // Creates a new folder in the signed in user's OneDrive account. Applies to personal or work accounts 288 | - (void)createFolder { 289 | MSGraphDriveItem *driveItem = [[MSGraphDriveItem alloc] initWithDictionary:@{[MSNameConflict rename].key : [MSNameConflict rename].value}]; 290 | driveItem.name = @"TestFolder"; 291 | driveItem.folder = [[MSGraphFolder alloc] init]; 292 | 293 | // Use itemByPath as below to create a subfolder under an existing folder 294 | [[[[[self.graphClient me]drive] root] request] getWithCompletion:^(MSGraphDriveItem *response, NSError *error) { 295 | if (error) { 296 | [self.delegate snippetFailure:error]; 297 | } 298 | else { 299 | driveItem.entityId = response.entityId; 300 | 301 | //Create folder 302 | [[[[[[self.graphClient me] drive] items:driveItem.entityId] children] request] addDriveItem:driveItem withCompletion:^(MSGraphDriveItem *response, NSError *error) { 303 | if (error) { 304 | [self.delegate snippetFailure:error]; 305 | } 306 | else { 307 | NSString *responseString = [NSString stringWithFormat:@"Created a folder %@", response.name]; 308 | [self.delegate snippetSuccess:responseString]; 309 | } 310 | }]; 311 | } 312 | }]; 313 | } 314 | 315 | 316 | // Downloads a file into the signed in user's OneDrive account. Applies to personal or work accounts 317 | - (void)downloadFile { 318 | [self createFilewithCompletion:^(MSGraphDriveItem *driveItem, NSError *error) { 319 | if (error) { 320 | [self.delegate snippetFailure:error]; 321 | } 322 | else { 323 | [[[[[self.graphClient me] drive] items:driveItem.entityId] contentRequest] downloadWithCompletion:^(NSURL *location, NSURLResponse *response, NSError *error) { 324 | if (error) { 325 | [self.delegate snippetFailure:error]; 326 | } 327 | else { 328 | NSString *responseString = [NSString stringWithFormat:@"Downloaded file at %@", location]; 329 | [self.delegate snippetSuccess:responseString]; 330 | } 331 | }]; 332 | } 333 | }]; 334 | } 335 | 336 | 337 | // Uploads a file in the signed in user's OneDrive account. Applies to personal or work accounts 338 | - (void)updateFile { 339 | [self createFilewithCompletion:^(MSGraphDriveItem *driveItem, NSError *error) { 340 | if (error) { 341 | [self.delegate snippetFailure:error]; 342 | } 343 | else { 344 | NSString *testText = @"NewTextValue"; 345 | NSData *uploadData = [testText dataUsingEncoding:NSUTF8StringEncoding]; 346 | 347 | [[[[[self.graphClient me] drive] items:driveItem.entityId] contentRequest] uploadFromData:uploadData completion:^(MSGraphDriveItem *response, NSError *error) { 348 | if (error) { 349 | [self.delegate snippetFailure:error]; 350 | } 351 | else { 352 | NSString *responseString = [NSString stringWithFormat: @"File %@ contents updated",response.name]; 353 | [self.delegate snippetSuccess:responseString]; 354 | } 355 | }]; 356 | } 357 | }]; 358 | } 359 | 360 | 361 | // Renames a file in the signed in user's OneDrive account. Applies to personal or work accounts 362 | - (void)renameFile { 363 | [self createFilewithCompletion:^(MSGraphDriveItem *driveItem, NSError *error) { 364 | if (error) { 365 | [self.delegate snippetFailure:error]; 366 | } 367 | else { 368 | driveItem.name = @"NewTextFileName"; 369 | [[[[[self.graphClient me] drive] items:driveItem.entityId] request] update:driveItem withCompletion:^(MSGraphDriveItem *response, NSError *error) { 370 | if (error) { 371 | [self.delegate snippetFailure:error]; 372 | } 373 | else { 374 | NSString *responseString = [NSString stringWithFormat:@"New name is %@",response.name]; 375 | [self.delegate snippetSuccess:responseString]; 376 | } 377 | }]; 378 | } 379 | }]; 380 | } 381 | 382 | 383 | // Deletes a file in the signed in user's OneDrive account. Applies to personal or work accounts 384 | - (void)deleteFile { 385 | [self createFilewithCompletion:^(MSGraphDriveItem *driveItem, NSError *error) { 386 | if (error) { 387 | [self.delegate snippetFailure:error]; 388 | } 389 | else { 390 | [[[[[self.graphClient me] drive] items:driveItem.entityId] request] deleteWithCompletion:^(NSError *error) { 391 | if (error) { 392 | [self.delegate snippetFailure:error]; 393 | } 394 | else { 395 | NSString *responseString = @"File deleted"; 396 | [self.delegate snippetSuccess:responseString]; 397 | } 398 | }]; 399 | } 400 | }]; 401 | } 402 | 403 | 404 | // Get user's manager if they have one. Applies to work accounts only 405 | - (void)getManager { 406 | [[[[self.graphClient me] manager] request] getWithCompletion:^(MSGraphDirectoryObject *response, NSError *error) { 407 | if (error) { 408 | [self.delegate snippetFailure:error]; 409 | } 410 | else { 411 | NSString *responseString = [NSString stringWithFormat:@"Manager is %@\n\nFull object is %@", response.dictionaryFromItem[@"displayName"], response]; 412 | [self.delegate snippetSuccess:responseString]; 413 | } 414 | }]; 415 | } 416 | 417 | 418 | // Get user's direct reports. Applies to work accounts only 419 | - (void)getDirects { 420 | [[[[self.graphClient me] directReports] request] getWithCompletion:^(MSCollection *response, MSGraphUserDirectReportsCollectionWithReferencesRequest *nextRequest, NSError *error) { 421 | if (error) { 422 | [self.delegate snippetFailure:error]; 423 | } 424 | else { 425 | NSMutableString *responseString = [[NSMutableString alloc]initWithString:@"List of directs: \n"]; 426 | 427 | for (MSGraphDirectoryObject *direct in response.value) { 428 | [responseString appendFormat: @"%@", direct.dictionaryFromItem[@"displayName"]]; 429 | } 430 | 431 | if (nextRequest) { 432 | [responseString appendString:@"Next request available for more users"]; 433 | 434 | } 435 | [self.delegate snippetSuccess:responseString]; 436 | } 437 | }]; 438 | } 439 | 440 | 441 | // Gets the signed-in user's photo data if they have a photo. This snippet will return metadata for the user photo. Applies to work accounts only 442 | - (void)getPhoto { 443 | [[[[self.graphClient me]photo]request]getWithCompletion:^(MSGraphProfilePhoto *response, NSError *error) { 444 | if (error) { 445 | [self.delegate snippetFailure:error]; 446 | } 447 | else { 448 | NSString *responseString = [NSString stringWithFormat:@"Photo size is %d x %d", response.height, response.width]; 449 | [self.delegate snippetSuccess:responseString]; 450 | } 451 | }]; 452 | } 453 | 454 | 455 | // Creates a new user in the tenant. Applicable to work accounts with admin rights 456 | - (void)createUser { 457 | NSString *userId = [[NSProcessInfo processInfo] globallyUniqueString]; 458 | NSString *domainName = [[self.emailAddress componentsSeparatedByString:@"@"]lastObject]; 459 | NSString *upn = [[[NSString stringWithFormat:@"@"]stringByReplacingOccurrencesOfString:@"" withString:userId]stringByReplacingOccurrencesOfString:@"" withString:domainName]; 460 | 461 | MSGraphUser *newUser = [[MSGraphUser alloc]init]; 462 | MSGraphPasswordProfile *passProfile = [[MSGraphPasswordProfile alloc]init]; 463 | passProfile.password = @"!pass!word1"; 464 | 465 | newUser.accountEnabled = true; 466 | newUser.displayName = self.displayName; 467 | newUser.passwordProfile = passProfile; 468 | newUser.mailNickname = userId; 469 | newUser.userPrincipalName = upn; 470 | 471 | [[[self.graphClient users] request] addUser:newUser withCompletion:^(MSGraphUser *response, NSError *error) { 472 | if (error) { 473 | [self.delegate snippetFailure:error]; 474 | } 475 | else { 476 | NSString *responseString = [NSString stringWithFormat:@"User created: %@", response.displayName]; 477 | [self.delegate snippetSuccess:responseString]; 478 | } 479 | }]; 480 | } 481 | 482 | 483 | // Gets a collection of groups that the signed-in user is a member of. Applicable to work accounts with admin rights 484 | - (void)getUserGroups { 485 | [[[[self.graphClient me] memberOf] request] getWithCompletion:^(MSCollection *response, MSGraphUserMemberOfCollectionWithReferencesRequest *nextRequest, NSError *error) { 486 | if (error) { 487 | [self.delegate snippetFailure:error]; 488 | } 489 | else { 490 | NSMutableString *responseString = [[NSMutableString alloc]initWithString:@"List of groups: \n"]; 491 | 492 | for (MSGraphDirectoryObject *group in response.value) { 493 | [responseString appendFormat: @"%@", group.dictionaryFromItem[@"displayName"]]; 494 | } 495 | 496 | if (nextRequest) { 497 | [responseString appendString:@"Next request available for more groups."]; 498 | } 499 | 500 | [self.delegate snippetSuccess:responseString]; 501 | } 502 | }]; 503 | } 504 | 505 | 506 | #pragma mark - Snippets - Groups 507 | 508 | // Returns all of the groups in your tenant's directory. Applicable to work accounts with admin rights 509 | - (void)getAllGroups { 510 | [[[self.graphClient groups] request] getWithCompletion:^(MSCollection *response, MSGraphGroupsCollectionRequest *nextRequest, NSError *error) { 511 | if (error) { 512 | [self.delegate snippetFailure:error]; 513 | } 514 | else { 515 | NSMutableString *responseString = [[NSMutableString alloc]initWithString:@"List of all groups: \n"]; 516 | 517 | for (MSGraphDirectoryObject *group in response.value) { 518 | [responseString appendFormat: @"%@", group.dictionaryFromItem[@"displayName"]]; 519 | } 520 | 521 | if (nextRequest) { 522 | [responseString appendString:@"Next request available for more groups."]; 523 | } 524 | [self.delegate snippetSuccess:responseString]; 525 | } 526 | }]; 527 | } 528 | 529 | 530 | // Gets a specified group. Applicable to work accounts with admin rights 531 | - (void)getSingleGroup { 532 | [self createGroupwithCompletion:^(MSGraphGroup *group, NSError *error) { 533 | if (error) { 534 | [self.delegate snippetFailure:error]; 535 | } 536 | else { 537 | [[[[self.graphClient groups] group:group.entityId] request] getWithCompletion:^(MSGraphGroup *response, NSError *error) { 538 | if (error) { 539 | [self.delegate snippetFailure:error]; 540 | } 541 | else { 542 | NSString *responseString = [NSString stringWithFormat:@"Retrieved group: %@", response.displayName]; 543 | [self.delegate snippetSuccess:responseString]; 544 | } 545 | }]; 546 | } 547 | }]; 548 | } 549 | 550 | 551 | // Gets a specific group's members. Applicable to work accounts with admin rights 552 | - (void)getMembers { 553 | [self createGroupwithCompletion:^(MSGraphGroup *group, NSError *error) { 554 | if (error) { 555 | [self.delegate snippetFailure:error]; 556 | } 557 | else { 558 | [[[[[self.graphClient groups] group:group.entityId] members] request] getWithCompletion:^(MSCollection *response, MSGraphGroupMembersCollectionWithReferencesRequest *nextRequest, NSError *error) { 559 | if (error) { 560 | [self.delegate snippetFailure:error]; 561 | } 562 | else { 563 | NSMutableString *responseString = [[NSMutableString alloc]initWithString:@"List of members: \n"]; 564 | 565 | for (MSGraphDirectoryObject *member in response.value) { 566 | [responseString appendFormat: @"%@", member.dictionaryFromItem[@"displayName"]]; 567 | } 568 | 569 | if (nextRequest) { 570 | [responseString appendString:@"Next request available for more members."]; 571 | } 572 | 573 | [self.delegate snippetSuccess:responseString]; 574 | } 575 | }]; 576 | } 577 | }]; 578 | } 579 | 580 | 581 | // Gets a specific group's owners. Applicable to work accounts with admin rights 582 | - (void)getOwners { 583 | [self createGroupwithCompletion:^(MSGraphGroup *group, NSError *error) { 584 | if (error) { 585 | [self.delegate snippetFailure:error]; 586 | } 587 | else { 588 | [[[[[self.graphClient groups] group:group.entityId] owners] request] getWithCompletion:^(MSCollection *response, MSGraphGroupOwnersCollectionWithReferencesRequest *nextRequest, NSError *error) { 589 | if (error) { 590 | [self.delegate snippetFailure:error]; 591 | } 592 | else { 593 | NSMutableString *responseString = [[NSMutableString alloc]initWithString:@"List of owners: \n"]; 594 | 595 | for (MSGraphDirectoryObject *owner in response.value) { 596 | [responseString appendFormat: @"%@", owner.dictionaryFromItem[@"displayName"]]; 597 | } 598 | 599 | if (nextRequest) { 600 | [responseString appendString:@"Next request available for more owners."]; 601 | } 602 | 603 | [self.delegate snippetSuccess:responseString]; 604 | } 605 | }]; 606 | } 607 | }]; 608 | } 609 | 610 | 611 | // Creates a group in user's account. Applicable to work accounts with admin rights 612 | - (void)createGroup { 613 | MSGraphGroup *group = [self createGroupObject]; 614 | [[[self.graphClient groups] request] addGroup:group withCompletion:^(MSGraphGroup *response, NSError *error) { 615 | if (error) { 616 | [self.delegate snippetFailure:error]; 617 | } 618 | else { 619 | NSString *responseString = [NSString stringWithFormat:@"Group %@ was added", response.displayName]; 620 | [self.delegate snippetSuccess:responseString]; 621 | } 622 | }]; 623 | } 624 | 625 | 626 | // Creates and updates a group in user's account. Applicable to work accounts with admin rights 627 | - (void)updateGroup { 628 | [self createGroupwithCompletion:^(MSGraphGroup *group, NSError *error) { 629 | if (error) { 630 | [self.delegate snippetFailure:error]; 631 | } 632 | else { 633 | group.displayName = @"Updated Group Display Name"; 634 | [[[[self.graphClient groups] group:group.entityId] request] update:group 635 | withCompletion:^(MSGraphGroup *response, NSError *error) { 636 | if (error) { 637 | [self.delegate snippetFailure:error]; 638 | } 639 | else { 640 | NSString *responseString = [NSString stringWithFormat:@"Group %@ updated", response.displayName]; 641 | [self.delegate snippetSuccess:responseString]; 642 | } 643 | }]; 644 | } 645 | }]; 646 | } 647 | 648 | 649 | // Creates and deletes a group in user's account. Applicable to work accounts with admin rights 650 | - (void)deleteGroup { 651 | [self createGroupwithCompletion:^(MSGraphGroup *group, NSError *error) { 652 | if (error) { 653 | [self.delegate snippetFailure:error]; 654 | } 655 | else { 656 | [[[[self.graphClient groups] group:group.entityId] request] deleteWithCompletion:^(NSError *error) { 657 | if (error) { 658 | [self.delegate snippetFailure:error]; 659 | } 660 | else { 661 | NSString *responseString = @"Group has been deleted"; 662 | [self.delegate snippetSuccess:responseString]; 663 | } 664 | }]; 665 | } 666 | }]; 667 | } 668 | 669 | 670 | #pragma mark - Helper methods 671 | 672 | // Helper method to retrieve the logged in user's display name and email address 673 | - (void)getUserInfo { 674 | [[[self.graphClient me] request] getWithCompletion:^(MSGraphUser *response, NSError *error) { 675 | if (error) { 676 | NSLog(@"Retrieval of user account information failed - %@", error.localizedDescription); 677 | } 678 | else { 679 | self.emailAddress = response.mail; 680 | self.displayName = response.displayName; 681 | } 682 | }]; 683 | } 684 | 685 | 686 | // Helper method to create a new text file 687 | - (void)createFilewithCompletion: (void (^)(MSGraphDriveItem *driveItem, NSError *error))completed{ 688 | NSString *testFile = [[NSString alloc]init]; 689 | NSData *uploadData = [testFile dataUsingEncoding:NSUTF8StringEncoding]; 690 | [[[[[[self.graphClient me] drive] root] itemByPath:@"testSingleFile.text"] contentRequest] uploadFromData:uploadData completion:^(MSGraphDriveItem *response, NSError *error) { 691 | completed(response, error); 692 | }]; 693 | } 694 | 695 | 696 | // Helper method that creates and send a sample calendar event to Office 365 - calls - getEventObject 697 | - (void)createSampleEventwithCompletion: (void (^)(MSGraphEvent *event, NSError *error))completed { 698 | MSGraphEvent *event = [self getEventObject]; 699 | [[[[[self.graphClient me] calendar] events] request] addEvent:event withCompletion:^(MSGraphEvent *response, NSError *error) { 700 | completed(response, error); 701 | }]; 702 | } 703 | 704 | 705 | // Helper method that creates and send a sample user group in Office 365 - calls - createGroupObject 706 | - (void)createGroupwithCompletion: (void (^)(MSGraphGroup *group, NSError *error))completed { 707 | MSGraphGroup *group = [self createGroupObject]; 708 | [[[self.graphClient groups] request] addGroup:group withCompletion:^(MSGraphGroup *response, NSError *error) { 709 | completed(response, error); 710 | }]; 711 | } 712 | 713 | 714 | // Helper method to create a sample calendar event 715 | -(MSGraphEvent*) getEventObject { 716 | NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; 717 | [formatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss"]; 718 | 719 | MSGraphEvent *event = [[MSGraphEvent alloc] init]; 720 | event.Subject = [NSString stringWithFormat:@"New event created on %@", (NSString*)[NSDate date]]; 721 | event.type = [MSGraphEventType singleInstance]; 722 | 723 | MSGraphDateTimeTimeZone *eventStart = [[MSGraphDateTimeTimeZone alloc]init]; 724 | eventStart.dateTime = [formatter stringFromDate:[NSDate date]]; 725 | eventStart.timeZone = @"Pacific/Honolulu"; 726 | event.start= eventStart; 727 | 728 | MSGraphDateTimeTimeZone *eventEnd = [[MSGraphDateTimeTimeZone alloc]init]; 729 | eventEnd.dateTime = [formatter stringFromDate:[[NSDate date]dateByAddingTimeInterval:3600]]; 730 | eventEnd.timeZone = @"Pacific/Honolulu"; 731 | event.end = eventEnd; 732 | 733 | NSMutableArray *toAttendees = [[NSMutableArray alloc]init]; 734 | MSGraphAttendee *attendee = [[MSGraphAttendee alloc]init]; 735 | MSGraphEmailAddress *address = (MSGraphEmailAddress*)self.emailAddress; 736 | 737 | attendee.emailAddress = address; 738 | [toAttendees addObject:attendee]; 739 | 740 | return event; 741 | } 742 | 743 | 744 | // Create a sample test message to send to specified user account 745 | - (MSGraphMessage*) getSampleMessage{ 746 | MSGraphMessage *message = [[MSGraphMessage alloc]init]; 747 | MSGraphRecipient *toRecipient = [[MSGraphRecipient alloc]init]; 748 | MSGraphEmailAddress *email = [[MSGraphEmailAddress alloc]init]; 749 | 750 | email.address = self.emailAddress; 751 | toRecipient.emailAddress = email; 752 | 753 | NSMutableArray *toRecipients = [[NSMutableArray alloc]init]; 754 | [toRecipients addObject:toRecipient]; 755 | 756 | message.subject = @"Mail received from the Office 365 iOS Microsoft Graph Snippets Sample"; 757 | 758 | MSGraphItemBody *emailBody = [[MSGraphItemBody alloc]init]; 759 | NSString *htmlContentPath = [[NSBundle mainBundle] pathForResource:@"EmailBody" ofType:@"html"]; 760 | NSString *htmlContentString = [NSString stringWithContentsOfFile:htmlContentPath encoding:NSUTF8StringEncoding error:nil]; 761 | 762 | emailBody.content = htmlContentString; 763 | emailBody.contentType = [MSGraphBodyType html]; 764 | message.body = emailBody; 765 | 766 | message.toRecipients = toRecipients; 767 | 768 | return message; 769 | 770 | } 771 | 772 | 773 | // Helper method to greate a sample group object 774 | - (MSGraphGroup*)createGroupObject { 775 | MSGraphGroup *group = [[MSGraphGroup alloc]init]; 776 | group.displayName = @"New Sample Group"; 777 | group.mailEnabled = true; 778 | group.mailNickname = @"SampleNickname"; 779 | group.securityEnabled = false; 780 | group.groupTypes = @[@"Unified"]; 781 | 782 | return group; 783 | } 784 | 785 | 786 | @end 787 | --------------------------------------------------------------------------------