├── .gitignore ├── CONTRIBUTING.md ├── License.txt ├── NOTICES.md ├── O365-iOS-Microsoft-Graph-Connect-Swift.xcodeproj └── project.pbxproj ├── O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── O365-iOS-Microsoft-Graph-Connect-Swift ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── test.imageset │ │ ├── Contents.json │ │ └── test.png ├── AuthenticationClass.swift ├── AuthenticationConstants.swift ├── Base.lproj │ ├── EmailBody.html │ ├── EmailPostContent.json │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── ConnectViewController.swift ├── CreateSharingLink.json ├── Info.plist ├── O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h ├── O365-iOS-Microsoft-Graph-Connect-Swift.entitlements ├── OneDriveFileLink.swift └── SendMailViewController_WithPromise.swift ├── Podfile ├── Podfile.lock ├── README-Localized ├── README-de-de.md ├── README-es-es.md ├── README-fr-fr.md ├── README-ja-jp.md ├── README-pt-br.md ├── README-ru-ru.md ├── README-zh-cn.md └── README-zh-tw.md └── README.md /.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 | 44 | ### OSX ### 45 | .DS_Store 46 | .AppleDouble 47 | .LSOverride 48 | 49 | # Icon must end with two \r 50 | Icon 51 | 52 | # Thumbnails 53 | ._* 54 | 55 | # Files that might appear in the root of a volume 56 | .DocumentRevisions-V100 57 | .fseventsd 58 | .Spotlight-V100 59 | .TemporaryItems 60 | .Trashes 61 | .VolumeIcon.icns 62 | 63 | # Directories potentially created on remote AFP share 64 | .AppleDB 65 | .AppleDesktop 66 | Network Trash Folder 67 | Temporary Items 68 | .apdisk 69 | 70 | # Carthage 71 | Carthage/Checkouts 72 | Carthage/Build -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | 4 | Copyright (c) 2016 Microsoft Corporation 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. -------------------------------------------------------------------------------- /NOTICES.md: -------------------------------------------------------------------------------- 1 | This project uses the following third-party components: 2 | 3 | [PromiseKit](https://github.com/mxcl/PromiseKit), which is a registered trademark (TM) of Max Howell, and is available under the [MIT License](http://www.opensource.org/licenses/mit-license.php). 4 | 5 | 6 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 15C44B42F45719C4ED164354 /* Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31BA5059B9E76A42C79E56F8 /* Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework */; }; 11 | 96097C361C5977BB00332CBF /* EmailPostContent.json in Resources */ = {isa = PBXBuildFile; fileRef = 96097C341C5977BB00332CBF /* EmailPostContent.json */; }; 12 | 96097C391C59783000332CBF /* EmailBody.html in Resources */ = {isa = PBXBuildFile; fileRef = 96097C371C59783000332CBF /* EmailBody.html */; }; 13 | 969D2FE81C57EE48007E9DB0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 969D2FE71C57EE48007E9DB0 /* AppDelegate.swift */; }; 14 | 969D2FEF1C57EE48007E9DB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 969D2FEE1C57EE48007E9DB0 /* Assets.xcassets */; }; 15 | 969D2FF21C57EE48007E9DB0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 969D2FF01C57EE48007E9DB0 /* LaunchScreen.storyboard */; }; 16 | 969D2FFD1C57EEC4007E9DB0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 969D2FFB1C57EEC4007E9DB0 /* Main.storyboard */; }; 17 | 969D30051C57F5A6007E9DB0 /* AuthenticationConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 969D30041C57F5A6007E9DB0 /* AuthenticationConstants.swift */; }; 18 | 969D30071C5833F4007E9DB0 /* ConnectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 969D30061C5833F4007E9DB0 /* ConnectViewController.swift */; }; 19 | CF29C7901F338AAE00C6F07C /* MSAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CF29C78F1F338AAE00C6F07C /* MSAL.framework */; }; 20 | CF9267311F95629F003EED65 /* SendMailViewController_WithPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF9267301F95629F003EED65 /* SendMailViewController_WithPromise.swift */; }; 21 | CFB93F011F38E5EA00111610 /* AuthenticationClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFB93F001F38E5EA00111610 /* AuthenticationClass.swift */; }; 22 | CFCC68DC1FAD1B62007A0CBD /* CreateSharingLink.json in Resources */ = {isa = PBXBuildFile; fileRef = CFCC68DB1FAD1B61007A0CBD /* CreateSharingLink.json */; }; 23 | CFCC68DE1FAD2F5B007A0CBD /* OneDriveFileLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFCC68DD1FAD2F5B007A0CBD /* OneDriveFileLink.swift */; }; 24 | CFDA99F41F95653C00927E07 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CFDA99F51F95653C00927E07 /* PromiseKit.framework */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 31BA5059B9E76A42C79E56F8 /* Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 360D32B96A5688972576B6BD /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-O365-iOS-Microsoft-Graph-Connect-Swift.debug.xcconfig"; path = "Target Support Files/Pods-O365-iOS-Microsoft-Graph-Connect-Swift/Pods-O365-iOS-Microsoft-Graph-Connect-Swift.debug.xcconfig"; sourceTree = ""; }; 30 | 96097C351C5977BB00332CBF /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = Base; path = Base.lproj/EmailPostContent.json; sourceTree = ""; }; 31 | 96097C381C59783000332CBF /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = Base; path = Base.lproj/EmailBody.html; sourceTree = ""; }; 32 | 969D2FE41C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "O365-iOS-Microsoft-Graph-Connect-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 969D2FE71C57EE48007E9DB0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | 969D2FEE1C57EE48007E9DB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | 969D2FF11C57EE48007E9DB0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | 969D2FF31C57EE48007E9DB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 969D2FFC1C57EEC4007E9DB0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 969D30001C57F099007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h"; sourceTree = ""; }; 39 | 969D30041C57F5A6007E9DB0 /* AuthenticationConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationConstants.swift; sourceTree = ""; }; 40 | 969D30061C5833F4007E9DB0 /* ConnectViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectViewController.swift; sourceTree = ""; }; 41 | A7274251A108770B18579C9C /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-O365-iOS-Microsoft-Graph-Connect-Swift.release.xcconfig"; path = "Target Support Files/Pods-O365-iOS-Microsoft-Graph-Connect-Swift/Pods-O365-iOS-Microsoft-Graph-Connect-Swift.release.xcconfig"; sourceTree = ""; }; 42 | CF29C78F1F338AAE00C6F07C /* MSAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MSAL.framework; path = Carthage/Build/iOS/MSAL.framework; sourceTree = ""; }; 43 | CF9267301F95629F003EED65 /* SendMailViewController_WithPromise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendMailViewController_WithPromise.swift; sourceTree = ""; }; 44 | CFB93F001F38E5EA00111610 /* AuthenticationClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationClass.swift; sourceTree = ""; }; 45 | CFC558E6208E468B002E16E9 /* O365-iOS-Microsoft-Graph-Connect-Swift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "O365-iOS-Microsoft-Graph-Connect-Swift.entitlements"; sourceTree = ""; }; 46 | CFCC68DB1FAD1B61007A0CBD /* CreateSharingLink.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CreateSharingLink.json; sourceTree = ""; }; 47 | CFCC68DD1FAD2F5B007A0CBD /* OneDriveFileLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneDriveFileLink.swift; sourceTree = ""; }; 48 | CFDA99F51F95653C00927E07 /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 969D2FE11C57EE48007E9DB0 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | CFDA99F41F95653C00927E07 /* PromiseKit.framework in Frameworks */, 57 | CF29C7901F338AAE00C6F07C /* MSAL.framework in Frameworks */, 58 | 15C44B42F45719C4ED164354 /* Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 1A89F68346D3FAB5CF55AC1B /* Frameworks */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | CFDA99F51F95653C00927E07 /* PromiseKit.framework */, 69 | CF29C78F1F338AAE00C6F07C /* MSAL.framework */, 70 | 31BA5059B9E76A42C79E56F8 /* Pods_O365_iOS_Microsoft_Graph_Connect_Swift.framework */, 71 | ); 72 | name = Frameworks; 73 | sourceTree = ""; 74 | }; 75 | 969D2FDB1C57EE48007E9DB0 = { 76 | isa = PBXGroup; 77 | children = ( 78 | 969D2FE61C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift */, 79 | 969D2FE51C57EE48007E9DB0 /* Products */, 80 | 1A89F68346D3FAB5CF55AC1B /* Frameworks */, 81 | B4CF144E485AA9253C8727D5 /* Pods */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 969D2FE51C57EE48007E9DB0 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 969D2FE41C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift.app */, 89 | ); 90 | name = Products; 91 | sourceTree = ""; 92 | }; 93 | 969D2FE61C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | CFC558E6208E468B002E16E9 /* O365-iOS-Microsoft-Graph-Connect-Swift.entitlements */, 97 | CFCC68DB1FAD1B61007A0CBD /* CreateSharingLink.json */, 98 | CFB93F001F38E5EA00111610 /* AuthenticationClass.swift */, 99 | 96097C371C59783000332CBF /* EmailBody.html */, 100 | 96097C341C5977BB00332CBF /* EmailPostContent.json */, 101 | 969D2FE71C57EE48007E9DB0 /* AppDelegate.swift */, 102 | 969D2FEE1C57EE48007E9DB0 /* Assets.xcassets */, 103 | 969D2FF01C57EE48007E9DB0 /* LaunchScreen.storyboard */, 104 | 969D2FFB1C57EEC4007E9DB0 /* Main.storyboard */, 105 | 969D2FF31C57EE48007E9DB0 /* Info.plist */, 106 | 969D30041C57F5A6007E9DB0 /* AuthenticationConstants.swift */, 107 | 969D30001C57F099007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h */, 108 | 969D30061C5833F4007E9DB0 /* ConnectViewController.swift */, 109 | CF9267301F95629F003EED65 /* SendMailViewController_WithPromise.swift */, 110 | CFCC68DD1FAD2F5B007A0CBD /* OneDriveFileLink.swift */, 111 | ); 112 | path = "O365-iOS-Microsoft-Graph-Connect-Swift"; 113 | sourceTree = ""; 114 | }; 115 | B4CF144E485AA9253C8727D5 /* Pods */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 360D32B96A5688972576B6BD /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.debug.xcconfig */, 119 | A7274251A108770B18579C9C /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.release.xcconfig */, 120 | ); 121 | path = Pods; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | 969D2FE31C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = 969D2FF61C57EE48007E9DB0 /* Build configuration list for PBXNativeTarget "O365-iOS-Microsoft-Graph-Connect-Swift" */; 130 | buildPhases = ( 131 | 6E8D4BD766A1C302DB31C89A /* [CP] Check Pods Manifest.lock */, 132 | 969D2FE01C57EE48007E9DB0 /* Sources */, 133 | 969D2FE11C57EE48007E9DB0 /* Frameworks */, 134 | 969D2FE21C57EE48007E9DB0 /* Resources */, 135 | 4D5E98E089115F3CEC5CF179 /* [CP] Embed Pods Frameworks */, 136 | ); 137 | buildRules = ( 138 | ); 139 | dependencies = ( 140 | ); 141 | name = "O365-iOS-Microsoft-Graph-Connect-Swift"; 142 | productName = "O365-iOS-Microsoft-Graph-Connect-Swift"; 143 | productReference = 969D2FE41C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift.app */; 144 | productType = "com.apple.product-type.application"; 145 | }; 146 | /* End PBXNativeTarget section */ 147 | 148 | /* Begin PBXProject section */ 149 | 969D2FDC1C57EE48007E9DB0 /* Project object */ = { 150 | isa = PBXProject; 151 | attributes = { 152 | LastSwiftUpdateCheck = 0720; 153 | LastUpgradeCheck = 1000; 154 | ORGANIZATIONNAME = "Jason Kim"; 155 | TargetAttributes = { 156 | 969D2FE31C57EE48007E9DB0 = { 157 | CreatedOnToolsVersion = 7.2; 158 | DevelopmentTeam = 627WDN8ZS4; 159 | LastSwiftMigration = 0820; 160 | ProvisioningStyle = Automatic; 161 | SystemCapabilities = { 162 | com.apple.Keychain = { 163 | enabled = 1; 164 | }; 165 | }; 166 | }; 167 | }; 168 | }; 169 | buildConfigurationList = 969D2FDF1C57EE48007E9DB0 /* Build configuration list for PBXProject "O365-iOS-Microsoft-Graph-Connect-Swift" */; 170 | compatibilityVersion = "Xcode 3.2"; 171 | developmentRegion = English; 172 | hasScannedForEncodings = 0; 173 | knownRegions = ( 174 | English, 175 | en, 176 | Base, 177 | ); 178 | mainGroup = 969D2FDB1C57EE48007E9DB0; 179 | productRefGroup = 969D2FE51C57EE48007E9DB0 /* Products */; 180 | projectDirPath = ""; 181 | projectRoot = ""; 182 | targets = ( 183 | 969D2FE31C57EE48007E9DB0 /* O365-iOS-Microsoft-Graph-Connect-Swift */, 184 | ); 185 | }; 186 | /* End PBXProject section */ 187 | 188 | /* Begin PBXResourcesBuildPhase section */ 189 | 969D2FE21C57EE48007E9DB0 /* Resources */ = { 190 | isa = PBXResourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | CFCC68DC1FAD1B62007A0CBD /* CreateSharingLink.json in Resources */, 194 | 969D2FFD1C57EEC4007E9DB0 /* Main.storyboard in Resources */, 195 | 96097C391C59783000332CBF /* EmailBody.html in Resources */, 196 | 969D2FF21C57EE48007E9DB0 /* LaunchScreen.storyboard in Resources */, 197 | 96097C361C5977BB00332CBF /* EmailPostContent.json in Resources */, 198 | 969D2FEF1C57EE48007E9DB0 /* Assets.xcassets in Resources */, 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXResourcesBuildPhase section */ 203 | 204 | /* Begin PBXShellScriptBuildPhase section */ 205 | 4D5E98E089115F3CEC5CF179 /* [CP] Embed Pods Frameworks */ = { 206 | isa = PBXShellScriptBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | inputFileListPaths = ( 211 | ); 212 | inputPaths = ( 213 | "${PODS_ROOT}/Target Support Files/Pods-O365-iOS-Microsoft-Graph-Connect-Swift/Pods-O365-iOS-Microsoft-Graph-Connect-Swift-frameworks.sh", 214 | "${BUILT_PRODUCTS_DIR}/MSAL/MSAL.framework", 215 | "${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework", 216 | ); 217 | name = "[CP] Embed Pods Frameworks"; 218 | outputFileListPaths = ( 219 | ); 220 | outputPaths = ( 221 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MSAL.framework", 222 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework", 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | shellPath = /bin/sh; 226 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-O365-iOS-Microsoft-Graph-Connect-Swift/Pods-O365-iOS-Microsoft-Graph-Connect-Swift-frameworks.sh\"\n"; 227 | showEnvVarsInLog = 0; 228 | }; 229 | 6E8D4BD766A1C302DB31C89A /* [CP] Check Pods Manifest.lock */ = { 230 | isa = PBXShellScriptBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | inputFileListPaths = ( 235 | ); 236 | inputPaths = ( 237 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 238 | "${PODS_ROOT}/Manifest.lock", 239 | ); 240 | name = "[CP] Check Pods Manifest.lock"; 241 | outputFileListPaths = ( 242 | ); 243 | outputPaths = ( 244 | "$(DERIVED_FILE_DIR)/Pods-O365-iOS-Microsoft-Graph-Connect-Swift-checkManifestLockResult.txt", 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | shellPath = /bin/sh; 248 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 249 | showEnvVarsInLog = 0; 250 | }; 251 | /* End PBXShellScriptBuildPhase section */ 252 | 253 | /* Begin PBXSourcesBuildPhase section */ 254 | 969D2FE01C57EE48007E9DB0 /* Sources */ = { 255 | isa = PBXSourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | CFB93F011F38E5EA00111610 /* AuthenticationClass.swift in Sources */, 259 | 969D2FE81C57EE48007E9DB0 /* AppDelegate.swift in Sources */, 260 | 969D30051C57F5A6007E9DB0 /* AuthenticationConstants.swift in Sources */, 261 | 969D30071C5833F4007E9DB0 /* ConnectViewController.swift in Sources */, 262 | CF9267311F95629F003EED65 /* SendMailViewController_WithPromise.swift in Sources */, 263 | CFCC68DE1FAD2F5B007A0CBD /* OneDriveFileLink.swift in Sources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXSourcesBuildPhase section */ 268 | 269 | /* Begin PBXVariantGroup section */ 270 | 96097C341C5977BB00332CBF /* EmailPostContent.json */ = { 271 | isa = PBXVariantGroup; 272 | children = ( 273 | 96097C351C5977BB00332CBF /* Base */, 274 | ); 275 | name = EmailPostContent.json; 276 | sourceTree = ""; 277 | }; 278 | 96097C371C59783000332CBF /* EmailBody.html */ = { 279 | isa = PBXVariantGroup; 280 | children = ( 281 | 96097C381C59783000332CBF /* Base */, 282 | ); 283 | name = EmailBody.html; 284 | sourceTree = ""; 285 | }; 286 | 969D2FF01C57EE48007E9DB0 /* LaunchScreen.storyboard */ = { 287 | isa = PBXVariantGroup; 288 | children = ( 289 | 969D2FF11C57EE48007E9DB0 /* Base */, 290 | ); 291 | name = LaunchScreen.storyboard; 292 | sourceTree = ""; 293 | }; 294 | 969D2FFB1C57EEC4007E9DB0 /* Main.storyboard */ = { 295 | isa = PBXVariantGroup; 296 | children = ( 297 | 969D2FFC1C57EEC4007E9DB0 /* Base */, 298 | ); 299 | name = Main.storyboard; 300 | sourceTree = ""; 301 | }; 302 | /* End PBXVariantGroup section */ 303 | 304 | /* Begin XCBuildConfiguration section */ 305 | 969D2FF41C57EE48007E9DB0 /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 314 | CLANG_WARN_BOOL_CONVERSION = YES; 315 | CLANG_WARN_COMMA = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 318 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INFINITE_RECURSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 325 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 328 | CLANG_WARN_STRICT_PROTOTYPES = YES; 329 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = dwarf; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | ENABLE_TESTABILITY = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_OPTIMIZATION_LEVEL = 0; 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 352 | MTL_ENABLE_DEBUG_INFO = YES; 353 | ONLY_ACTIVE_ARCH = YES; 354 | SDKROOT = iphoneos; 355 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 969D2FF51C57EE48007E9DB0 /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 365 | CLANG_CXX_LIBRARY = "libc++"; 366 | CLANG_ENABLE_MODULES = YES; 367 | CLANG_ENABLE_OBJC_ARC = YES; 368 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 369 | CLANG_WARN_BOOL_CONVERSION = YES; 370 | CLANG_WARN_COMMA = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_EMPTY_BODY = YES; 375 | CLANG_WARN_ENUM_CONVERSION = YES; 376 | CLANG_WARN_INFINITE_RECURSION = YES; 377 | CLANG_WARN_INT_CONVERSION = YES; 378 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 380 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 382 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 383 | CLANG_WARN_STRICT_PROTOTYPES = YES; 384 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 385 | CLANG_WARN_UNREACHABLE_CODE = YES; 386 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 387 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 388 | COPY_PHASE_STRIP = NO; 389 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 390 | ENABLE_NS_ASSERTIONS = NO; 391 | ENABLE_STRICT_OBJC_MSGSEND = YES; 392 | GCC_C_LANGUAGE_STANDARD = gnu99; 393 | GCC_NO_COMMON_BLOCKS = YES; 394 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 395 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 396 | GCC_WARN_UNDECLARED_SELECTOR = YES; 397 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 398 | GCC_WARN_UNUSED_FUNCTION = YES; 399 | GCC_WARN_UNUSED_VARIABLE = YES; 400 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 401 | MTL_ENABLE_DEBUG_INFO = NO; 402 | SDKROOT = iphoneos; 403 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 404 | TARGETED_DEVICE_FAMILY = "1,2"; 405 | VALIDATE_PRODUCT = YES; 406 | }; 407 | name = Release; 408 | }; 409 | 969D2FF71C57EE48007E9DB0 /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | baseConfigurationReference = 360D32B96A5688972576B6BD /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.debug.xcconfig */; 412 | buildSettings = { 413 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 414 | CLANG_ENABLE_MODULES = YES; 415 | CODE_SIGN_ENTITLEMENTS = "O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift.entitlements"; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | DEVELOPMENT_TEAM = 627WDN8ZS4; 418 | FRAMEWORK_SEARCH_PATHS = ( 419 | "$(inherited)", 420 | "$(PROJECT_DIR)/Carthage/Build/iOS", 421 | ); 422 | INFOPLIST_FILE = "O365-iOS-Microsoft-Graph-Connect-Swift/Info.plist"; 423 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 424 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | PROVISIONING_PROFILE_SPECIFIER = ""; 427 | SWIFT_OBJC_BRIDGING_HEADER = "O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h"; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 4.2; 430 | }; 431 | name = Debug; 432 | }; 433 | 969D2FF81C57EE48007E9DB0 /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | baseConfigurationReference = A7274251A108770B18579C9C /* Pods-O365-iOS-Microsoft-Graph-Connect-Swift.release.xcconfig */; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | CLANG_ENABLE_MODULES = YES; 439 | CODE_SIGN_ENTITLEMENTS = "O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift.entitlements"; 440 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 441 | DEVELOPMENT_TEAM = 627WDN8ZS4; 442 | FRAMEWORK_SEARCH_PATHS = ( 443 | "$(inherited)", 444 | "$(PROJECT_DIR)/Carthage/Build/iOS", 445 | ); 446 | INFOPLIST_FILE = "O365-iOS-Microsoft-Graph-Connect-Swift/Info.plist"; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 448 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST"; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | PROVISIONING_PROFILE_SPECIFIER = ""; 451 | SWIFT_OBJC_BRIDGING_HEADER = "O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.h"; 452 | SWIFT_VERSION = 4.2; 453 | }; 454 | name = Release; 455 | }; 456 | /* End XCBuildConfiguration section */ 457 | 458 | /* Begin XCConfigurationList section */ 459 | 969D2FDF1C57EE48007E9DB0 /* Build configuration list for PBXProject "O365-iOS-Microsoft-Graph-Connect-Swift" */ = { 460 | isa = XCConfigurationList; 461 | buildConfigurations = ( 462 | 969D2FF41C57EE48007E9DB0 /* Debug */, 463 | 969D2FF51C57EE48007E9DB0 /* Release */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 969D2FF61C57EE48007E9DB0 /* Build configuration list for PBXNativeTarget "O365-iOS-Microsoft-Graph-Connect-Swift" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 969D2FF71C57EE48007E9DB0 /* Debug */, 472 | 969D2FF81C57EE48007E9DB0 /* Release */, 473 | ); 474 | defaultConfigurationIsVisible = 0; 475 | defaultConfigurationName = Release; 476 | }; 477 | /* End XCConfigurationList section */ 478 | }; 479 | rootObject = 969D2FDC1C57EE48007E9DB0 /* Project object */; 480 | } 481 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 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 UIKit 7 | import MSAL 8 | 9 | @UIApplicationMain 10 | class AppDelegate: UIResponder, UIApplicationDelegate { 11 | var window: UIWindow? 12 | 13 | // @brief Handles inbound URLs. Checks if the URL matches the redirect URI for a pending AppAuth 14 | // authorization request and if so, will look for the code in the response. 15 | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 16 | print("Received callback!") 17 | MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: sourceApplication!) 18 | 19 | return true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Assets.xcassets/test.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "test.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Assets.xcassets/test.imageset/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/ios-swift-connect-rest-sample/036f8868e729fb41f2b94aa74e51773a828e467d/O365-iOS-Microsoft-Graph-Connect-Swift/Assets.xcassets/test.imageset/test.png -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/AuthenticationClass.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AuthenticationClass.swift 3 | // Graph-iOS-Swift-Connect 4 | 5 | import Foundation 6 | import MSAL 7 | 8 | class AuthenticationClass { 9 | // MARK: Properties and variables 10 | // Singleton class 11 | static let sharedInstance = AuthenticationClass() 12 | 13 | var authenticationProvider: MSALPublicClientApplication! 14 | var accessToken: String = "" 15 | var lastInitError: Error? 16 | 17 | init () { 18 | do { 19 | let authority = try MSALAADAuthority(url: URL(string:ApplicationConstants.kAuthority)!) 20 | 21 | let pcaConfig = MSALPublicClientApplicationConfig(clientId: ApplicationConstants.kClientId, redirectUri: ApplicationConstants.kRedirectUri, authority: authority) 22 | authenticationProvider = try MSALPublicClientApplication(configuration: pcaConfig) 23 | 24 | } catch let error as NSError { 25 | self.lastInitError = error 26 | } 27 | } 28 | 29 | /** 30 | Authenticates to Microsoft Graph. 31 | If a user has previously signed in before and not disconnected, silent log in 32 | will take place. 33 | If not, authentication will ask for credentials 34 | */ 35 | func connectToGraph(scopes: [String], 36 | completion: @escaping (_ error: ApplicationConstants.MSGraphError?, 37 | _ accessToken: String) -> Void) { 38 | do { 39 | if let initError = self.lastInitError { 40 | throw initError 41 | } 42 | 43 | // We check to see if we have a current logged in user. If we don't, then we need to sign someone in. 44 | // We throw an interactionRequired so that we trigger the interactive signin. 45 | 46 | // Acquire a token for an existing user silently 47 | guard let account = try authenticationProvider.allAccounts().first else { 48 | throw NSError(domain: "MSALErrorDomain", 49 | code: MSALError.interactionRequired.rawValue, 50 | userInfo: nil) 51 | } 52 | 53 | let parameters = MSALSilentTokenParameters(scopes: scopes, account:account) 54 | let authority = try MSALAADAuthority(url: URL(string:ApplicationConstants.kAuthority)!) 55 | parameters.authority = authority 56 | authenticationProvider.acquireTokenSilent(with: parameters) { result, error in 57 | // Could not acquire token silently 58 | guard let accessToken = result?.accessToken else { 59 | completion(ApplicationConstants.MSGraphError.nsErrorType(error: error! as NSError), "") 60 | return 61 | } 62 | 63 | self.accessToken = accessToken 64 | completion(nil, accessToken) 65 | } 66 | } catch let error { 67 | // interactionRequired means we need to ask the user to sign-in. This usually happens 68 | // when the user's Refresh Token is expired or if the user has changed their password 69 | // among other possible reasons. 70 | switch (error as NSError).code { 71 | case MSALError.interactionRequired.rawValue: 72 | let parameters = MSALInteractiveTokenParameters(scopes: scopes) 73 | authenticationProvider.acquireToken(with: parameters) { result, error in 74 | guard let accessToken = result?.accessToken else { 75 | completion(ApplicationConstants.MSGraphError.nsErrorType(error: error! as NSError), "") 76 | return 77 | } 78 | 79 | self.accessToken = accessToken 80 | completion(nil, accessToken) 81 | } 82 | default: 83 | completion(ApplicationConstants.MSGraphError.nsErrorType(error: error as NSError), 84 | error.localizedDescription) 85 | } 86 | } 87 | } 88 | 89 | func disconnect() { 90 | let accounts = try? authenticationProvider.allAccounts() 91 | guard let account = accounts?.first else { return } 92 | 93 | try? authenticationProvider.remove(account) 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/AuthenticationConstants.swift: -------------------------------------------------------------------------------- 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 Foundation 7 | 8 | // You'll set your application's ClientId and RedirectURI here. These values are provided by your Microsoft Azure app 9 | //registration. See README.MD for more details. 10 | 11 | struct ApplicationConstants { 12 | static let ResourceId = "https://graph.microsoft.com" 13 | static let kAuthority = "https://login.microsoftonline.com/common" 14 | static let kGraphURI = "https://graph.microsoft.com/v1.0/me/" 15 | static let kScopes = ["https://graph.microsoft.com/Mail.ReadWrite", 16 | "https://graph.microsoft.com/Mail.Send", 17 | "https://graph.microsoft.com/Files.ReadWrite", 18 | "https://graph.microsoft.com/User.ReadBasic.All"] 19 | 20 | /* 21 | To enable brokered auth, redirect uri must be in the form of "msauth.://auth". 22 | The redirect uri needs to be registered for your app in Azure Portal 23 | The scheme, i.e. "msauth." needs to be registered in the info.plist of the project 24 | */ 25 | static let kRedirectUri = "msauth.com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST://auth" 26 | // Put your client id here 27 | static let kClientId = "" 28 | 29 | /** 30 | Simple construct to encapsulate NSError. This could be expanded for more types of graph errors in future. 31 | */ 32 | enum MSGraphError: Error { 33 | case nsErrorType(error: NSError) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Base.lproj/EmailBody.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Congratulations!

8 |

This is a message from the Microsoft Graph Connect Sample. You are well on your way to incorporating Microsoft Graph endpoints in your apps.

See the photo you just uploaded! 9 |

What's next?

    10 |
  • Check out developer.microsoft.com/graph to start building Microsoft Graph apps today with all the latest tools, templates, and guidance to get started quickly.
  • 11 |
  • Use the Graph Explorer to explore the rest of the APIs and start your testing.
  • 12 |
  • Browse other samples on GitHub to see more of the APIs in action.
  • 13 |
14 |

Give us feedback

15 |

If you have any trouble running this sample, please 16 | log an issue on our repository.

For general questions about the Microsoft Graph API, post to Stack Overflow. Make sure that your questions or comments are tagged with [microsoftgraph].

17 |

Thanks, and happy coding!
18 | Your Microsoft Graph samples development team

19 |
20 | 21 | 22 | 23 | 25 | 27 | 29 | 30 | 31 |
See on GitHub 24 | Suggest on UserVoice 26 | Share on Twitter 28 |
32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/Base.lproj/EmailPostContent.json: -------------------------------------------------------------------------------- 1 | { 2 | "Message": { 3 | "toRecipients": [{ 4 | "emailAddress": { 5 | "address": "" 6 | } 7 | }], 8 | "@odata.type": "#microsoft.graph.message", 9 | "subject": "MAIL_SUBJECT", 10 | "body": { 11 | "contentType": "", 12 | "content": ""}, 13 | "attachments": [{ 14 | "@odata.type": "", 15 | "contentType": "", 16 | "contentBytes": "", 17 | "name": "" 18 | }] 19 | }, 20 | "SaveToSentItems": false 21 | } 22 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/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 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/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 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 79 | 80 | 81 | 82 | 83 | 84 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 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 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/ConnectViewController.swift: -------------------------------------------------------------------------------- 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 UIKit 7 | 8 | /** 9 | ConnectViewController is responsible for authenticating the user. 10 | Upon success, open SendMailViewController using predefined segue. 11 | Otherwise, show an error. 12 | 13 | In this sample a user-invoked cancellation is considered an error. 14 | */ 15 | class ConnectViewController: UIViewController { 16 | 17 | // Outlets 18 | @IBOutlet var connectButton: UIButton! 19 | @IBOutlet var activityIndicator: UIActivityIndicatorView! 20 | } 21 | 22 | // MARK: Actions 23 | private extension ConnectViewController { 24 | @IBAction func connect(_ sender: AnyObject) { 25 | authenticate() 26 | } 27 | 28 | @IBAction func disconnect(_ sender: AnyObject) { 29 | AuthenticationClass.sharedInstance.disconnect() 30 | self.navigationController?.popViewController(animated: true) 31 | } 32 | } 33 | 34 | // MARK: Authentication 35 | private extension ConnectViewController { 36 | func authenticate() { 37 | loadingUI(show: true) 38 | 39 | let scopes = ApplicationConstants.kScopes 40 | 41 | AuthenticationClass.sharedInstance 42 | .connectToGraph(scopes: scopes) { result, _ in 43 | defer { self.loadingUI(show: false) } 44 | 45 | if let graphError = result { 46 | switch graphError { 47 | case .nsErrorType(let nsError): 48 | print(NSLocalizedString("ERROR", comment: ""), nsError.userInfo) 49 | self.showError(message: NSLocalizedString("CHECK_LOG_ERROR", comment: "")) 50 | } 51 | } else { 52 | // Run on main thread 53 | DispatchQueue.main.async { [unowned self] in 54 | self.performSegue(withIdentifier: "sendMail", sender: nil) 55 | } 56 | } 57 | } 58 | } 59 | } 60 | 61 | // MARK: UI Helper 62 | private extension ConnectViewController { 63 | func loadingUI(show: Bool) { 64 | DispatchQueue.main.async { 65 | if show { 66 | self.activityIndicator.startAnimating() 67 | self.connectButton.setTitle(NSLocalizedString("CONNECTING", comment: ""), for: .normal) 68 | self.connectButton.isEnabled = false 69 | } else { 70 | self.activityIndicator.stopAnimating() 71 | self.connectButton.setTitle(NSLocalizedString("CONNECT", comment: ""), for: .normal) 72 | self.connectButton.isEnabled = true 73 | } 74 | } 75 | } 76 | 77 | func showError(message: String) { 78 | DispatchQueue.main.async { [unowned self] in 79 | let alertControl = UIAlertController(title: NSLocalizedString("ERROR", comment: ""), 80 | message: message, 81 | preferredStyle: .alert) 82 | 83 | alertControl.addAction(UIAlertAction(title: NSLocalizedString("CLOSE", comment: ""), 84 | style: .default, 85 | handler: nil)) 86 | 87 | self.present(alertControl, animated: true, completion: nil) 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/CreateSharingLink.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "view" 3 | } 4 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/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 | CFBundleURLTypes 22 | 23 | 24 | CFBundleTypeRole 25 | Editor 26 | CFBundleURLName 27 | $(PRODUCT_BUNDLE_IDENTIFIER) 28 | CFBundleURLSchemes 29 | 30 | msauth.com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST 31 | 32 | 33 | 34 | CFBundleVersion 35 | 1 36 | LSApplicationQueriesSchemes 37 | 38 | msauthv2 39 | msauth 40 | 41 | LSRequiresIPhoneOS 42 | 43 | UILaunchStoryboardName 44 | LaunchScreen 45 | UIMainStoryboardFile 46 | Main 47 | UIRequiredDeviceCapabilities 48 | 49 | armv7 50 | 51 | UISupportedInterfaceOrientations 52 | 53 | UIInterfaceOrientationPortrait 54 | UIInterfaceOrientationLandscapeLeft 55 | UIInterfaceOrientationLandscapeRight 56 | 57 | UISupportedInterfaceOrientations~ipad 58 | 59 | UIInterfaceOrientationPortrait 60 | UIInterfaceOrientationPortraitUpsideDown 61 | UIInterfaceOrientationLandscapeLeft 62 | UIInterfaceOrientationLandscapeRight 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift-Bridging-Header.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 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/O365-iOS-Microsoft-Graph-Connect-Swift.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | keychain-access-groups 6 | 7 | $(AppIdentifierPrefix)com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST 8 | $(AppIdentifierPrefix)com.microsoft.adalcache 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/OneDriveFileLink.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OneDriveFileLink.swift 3 | // O365-iOS-Microsoft-Graph-Connect-Swift 4 | // 5 | // Created by John Austin on 11/3/17. 6 | // Copyright © 2017 Jason Kim. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /** Structure of a OneDrive File Link: **/ 12 | /**------------------------------------**/ 13 | //{ 14 | // "id": "123ABC", 15 | // "roles": ["write"], 16 | // "link": { 17 | // "type": "view", 18 | // "scope": "anonymous", 19 | // "webUrl": "https://1drv.ms/A6913278E564460AA616C71B28AD6EB6", 20 | // "application": { 21 | // "id": "1234", 22 | // "displayName": "Sample Application" 23 | // }, 24 | // } 25 | //} 26 | 27 | struct OneDriveFileLink { 28 | let id: String 29 | let roles: [String] 30 | let link: [String: Any] 31 | let webUrl: String 32 | } 33 | 34 | extension OneDriveFileLink { 35 | init?(json: [String: Any]) { 36 | guard let id = json["id"] as? String, 37 | let link = json["link"] as? [String: Any], 38 | let roles = json["roles"] as? [String], 39 | let webUrl = link["webUrl"] as? String else { 40 | return nil 41 | } 42 | 43 | self.id = id 44 | self.roles = roles 45 | self.link = link 46 | self.webUrl = webUrl 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /O365-iOS-Microsoft-Graph-Connect-Swift/SendMailViewController_WithPromise.swift: -------------------------------------------------------------------------------- 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 UIKit 7 | import Foundation 8 | import PromiseKit 9 | 10 | /** 11 | SendMailViewController is responsible for sending email using the Microsoft Graph API. 12 | Recipient address is pre-filled with the signed-in user's email address, and it can 13 | be modified. 14 | 15 | */ 16 | class SendMailViewController: UIViewController { 17 | enum HTTPError: Error { 18 | typealias ErrorCode = Int 19 | 20 | case invalidRequest 21 | case unsupportedOperation 22 | case unauthorized 23 | case anyError 24 | case noError 25 | 26 | init(statusCode: ErrorCode) { 27 | switch statusCode { 28 | case 200...299: 29 | self = .noError 30 | case 400: 31 | self = .invalidRequest 32 | case 403: 33 | self = .unauthorized 34 | case 501: 35 | self = .unsupportedOperation 36 | case 401: 37 | self = .unauthorized 38 | default: 39 | self = .anyError 40 | } 41 | } 42 | } 43 | 44 | // MARK: Constants, Outlets, and Properties 45 | // Outlets 46 | @IBOutlet var headerLabel: UILabel! 47 | @IBOutlet var emailTextField: UITextField! 48 | @IBOutlet var sendMailButton: UIButton! 49 | @IBOutlet var statusTextView: UITextView! 50 | @IBOutlet var activityIndicator: UIActivityIndicatorView! 51 | 52 | // Constants 53 | let successString = "Check your Inbox, you have a new message." 54 | let failureString = "The email couldn't be sent. Check the log for errors." 55 | 56 | // Properties 57 | var userEmailAddress: String! 58 | var userName: String! 59 | var userProfilePicture: UIImage? 60 | var userPictureUrl: String? = "" 61 | 62 | // MARK: ViewController methods 63 | override func viewWillAppear(_ animated: Bool) { 64 | super.viewWillAppear(animated) 65 | self.navigationItem.hidesBackButton = true 66 | } 67 | 68 | override func viewDidLoad() { 69 | super.viewDidLoad() 70 | 71 | // Get user state values before creating mail message to be sent 72 | do { 73 | let accounts = try AuthenticationClass.sharedInstance.authenticationProvider.allAccounts() 74 | guard !(accounts.isEmpty) else { 75 | return self.updateUI(showActivityIndicator: false, statusText: "Failed to read accounts from cache!", sendMail: false) 76 | } 77 | 78 | self.userName = accounts[0].username! 79 | self.emailTextField.text = accounts[0].username! 80 | self.userEmailAddress = self.emailTextField.text 81 | self.headerLabel.text = "Hi, \(self.userName!)" 82 | 83 | updateUI(showActivityIndicator: true, statusText: "Getting picture", sendMail: true) 84 | 85 | //Important: Break out of async promise chain by declaring result returns Void 86 | 87 | _ = firstly { self.userPictureWork() } 88 | .then { image, url -> Promise in 89 | self.userPictureUrl = url 90 | self.userProfilePicture = image 91 | self.updateUI(showActivityIndicator: false, statusText: "", sendMail: true) 92 | 93 | return Promise() 94 | } 95 | .catch { _ in 96 | return self.updateUI(showActivityIndicator: false, statusText: "", sendMail: false) 97 | } 98 | } catch { 99 | self.updateUI(showActivityIndicator: false, 100 | statusText: "Error getting user profile picture.", 101 | sendMail: false) 102 | } 103 | } 104 | 105 | /** 106 | Asynchronous 107 | returns 501 (Not implemented) for msa accounts 108 | Gets the authenticated user's profile picture, uploads it to the user's OneDrive root folder, 109 | Requests a new web url sharing link to the uploaded photo. 110 | - returns: 111 | A Promise wrapping a tuple with the Image and its URL. 112 | */ 113 | func userPictureWork() -> Promise<(UIImage, String)> { 114 | return firstly { self.getUserPicture() } 115 | .then { self.uploadPicture(photo: $0!) } 116 | .then { image, itemId -> Promise<(UIImage, String)> in 117 | return self.createSharingLink(itemId: itemId, 118 | image: image) 119 | } 120 | } 121 | 122 | /** 123 | Async func. Get user's profile photo, upload photo to OneDrive, and get sharing link 124 | - returns: 125 | Promise. The user's profile picture 126 | */ 127 | func getUserPicture() -> Promise { 128 | return Promise { resolver in 129 | let urlRequest = buildRequest(operation: "GET", resource: "photo/$value") 130 | URLSession.shared.dataTask(with: urlRequest) { data, res, err in 131 | if let err = err { 132 | print(err.localizedDescription) 133 | resolver.reject(err) 134 | } 135 | 136 | guard self.checkResult(result: res!) == .noError else { 137 | resolver.fulfill(self.getDefaultPicture()) 138 | return 139 | } 140 | 141 | guard let data = data else { 142 | resolver.fulfill(self.getDefaultPicture()) 143 | return 144 | } 145 | 146 | guard let userImage = UIImage(data: data) else { 147 | resolver.reject(HTTPError.invalidRequest) 148 | return 149 | } 150 | 151 | self.userProfilePicture = userImage 152 | resolver.fulfill(userImage) 153 | return 154 | }.resume() 155 | } 156 | } 157 | 158 | func getDefaultPicture() -> UIImage { 159 | self.userProfilePicture = UIImage(named: "test") ?? self.userProfilePicture 160 | 161 | return self.userProfilePicture! 162 | } 163 | 164 | /** 165 | Async func. Uploads a UIImage object to the signed in user's OneDrive root folder 166 | - Returns: 167 | A Promise encapsulating a tuple of the user's profile image and its URL as a String. 168 | - Parameters: 169 | - UIImage: The image to upload to OneDrive 170 | */ 171 | func uploadPicture(photo: UIImage) -> Promise<(UIImage, String)> { 172 | return Promise { resolver in 173 | let uploadRequestUrl = self.buildRequest(operation: "PUT", 174 | resource: "drive/root:/me.jpg:/content", 175 | withBody: photo.jpegData(compressionQuality: 1.0)!) 176 | 177 | URLSession.shared.dataTask(with: uploadRequestUrl) { data, res, err in 178 | if let err = err { 179 | resolver.reject(err) 180 | return 181 | } 182 | 183 | guard let responseContent = data, 184 | self.checkResult(result: res!) == .noError else { 185 | resolver.reject(HTTPError.invalidRequest) 186 | return 187 | } 188 | 189 | // Data can be serialized to a DriveItem object 190 | // https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/driveitem 191 | let itemId = self.getValueFromResponse(json: responseContent, key: "id") 192 | resolver.fulfill((photo, itemId)) 193 | }.resume() 194 | } 195 | } 196 | 197 | /** 198 | Async func. Requests a new sharing link for the OneDrive item specified by the item id. 199 | - returns: 200 | - Promise. The new sharing link and the image wrapped in a Promise 201 | */ 202 | func createSharingLink(itemId: String, image: UIImage) -> Promise<(UIImage, String)> { 203 | return Promise { resolver in 204 | // Create Data object for the JSON payload 205 | guard let sharingLinkFilePath = Bundle.main.path(forResource: "CreateSharingLink", ofType: "json") else { 206 | resolver.reject(HTTPError.invalidRequest) 207 | return 208 | } 209 | 210 | do { 211 | let sharingLinkcontent = try String(contentsOfFile: sharingLinkFilePath, encoding: String.Encoding.utf8) 212 | let jsonPayload: Data = sharingLinkcontent.data(using: String.Encoding.utf8)! 213 | let uploadRequestUrl = self.buildRequest(operation: "POST", 214 | resource: "drive/items/\(itemId)/createLink", 215 | withBody: jsonPayload) 216 | 217 | URLSession.shared.dataTask(with: uploadRequestUrl) { data, res, err in 218 | if let err = err { 219 | resolver.reject(err) 220 | return 221 | } 222 | 223 | guard let responseContent = data, 224 | self.checkResult(result: res!) == .noError else { 225 | resolver.reject(HTTPError.invalidRequest) 226 | return 227 | } 228 | 229 | // Data can be serialized to a DriveItem object 230 | // https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/driveitem 231 | do { 232 | let resultJson = try JSONSerialization.jsonObject(with: responseContent, 233 | options: []) 234 | let sharingLink = (OneDriveFileLink(json: resultJson as? [String: AnyObject] ?? [:])?.webUrl)! 235 | resolver.fulfill((image, sharingLink)) 236 | } catch let error as NSError { 237 | print(error) 238 | } 239 | }.resume() 240 | } 241 | } 242 | } 243 | 244 | // MARK: HTTPS helper functions 245 | 246 | /** 247 | Gets the HTTP status code from an URLResponse and returns a custom HTTPError set to an emuneration from 248 | expected HTTP codes 249 | - Returns: 250 | Custom HTTPError object of type Error 251 | - Parameters 252 | - URLResponse: The response to an HTTPRequest 253 | */ 254 | func checkResult(result: URLResponse) -> HTTPError { 255 | let statusCode = (result as? HTTPURLResponse)?.statusCode ?? 400 256 | 257 | return HTTPError(statusCode: statusCode) 258 | } 259 | 260 | /** 261 | Gets a value from a JSON key/value pair by using the key parameter. 262 | - returns: 263 | The desired value as String 264 | 265 | - parameters: 266 | - Data: The JSON data to extract value from 267 | - String: The desired key 268 | */ 269 | func getValueFromResponse(json: Data, key: String) -> String { 270 | do { 271 | let resultJson = try JSONSerialization.jsonObject(with: json, options: []) as? [String: AnyObject] 272 | return self.getValueFromJsonObject(key: key, jsonObject: resultJson!) 273 | } catch let error as NSError { 274 | print("Failed deserializing JSON: \(error)") 275 | return "" 276 | } 277 | } 278 | 279 | func getValueFromJsonObject(key: String, 280 | jsonObject: [String: AnyObject]) -> String { 281 | let jsonValue = jsonObject[key] 282 | 283 | if let stringArray = jsonValue as? [String: AnyObject] { 284 | return self.getValueFromJsonObject(key: key, jsonObject: stringArray) 285 | } else { 286 | return jsonValue as? String ?? "" 287 | } 288 | } 289 | 290 | // MARK: IBActions 291 | 292 | /** 293 | Created an email message and sends it to a REST endpoint 294 | */ 295 | @IBAction func sendMail(_ sender: AnyObject) { 296 | // Fetch content from file 297 | updateUI(showActivityIndicator: true, statusText: "Sending", sendMail: false) 298 | 299 | guard let uploadContent = mailContent() else { 300 | updateUI(showActivityIndicator: false, 301 | statusText: "Error assembling the mail content.", sendMail: false) 302 | return 303 | } 304 | 305 | sendMailRESTWithContent(uploadContent) 306 | } 307 | 308 | // MARK: REST mail helper methods 309 | /** 310 | Prepare mail content by loading the files from resources and replacing placeholders with the 311 | HTML body. 312 | */ 313 | func mailContent() -> Data? { 314 | guard let emailFilePath = Bundle.main.path(forResource: "EmailPostContent", ofType: "json"), 315 | let emailBodyFilePath = Bundle.main.path(forResource: "EmailBody", ofType: "html") else { 316 | return nil 317 | } 318 | 319 | do { 320 | // Prepare upload content 321 | let emailContent = try String(contentsOfFile: emailFilePath, encoding: String.Encoding.utf8) 322 | let emailBodyRaw = try String(contentsOfFile: emailBodyFilePath, encoding: String.Encoding.utf8) 323 | 324 | // Request doesn't accept a single quotation mark("), so change it to the acceptable form (\") 325 | let emailValidBody = emailBodyRaw 326 | .replacingOccurrences(of: "\"", with: "\\\"") 327 | .replacingOccurrences(of: "a href=%s", with: ("a href=" + self.userPictureUrl!)) 328 | 329 | let imageData = self.userProfilePicture!.jpegData(compressionQuality: 1.0)! 330 | 331 | let emailPostContent = emailContent 332 | .replacingOccurrences(of: "", with: self.emailTextField.text!) 333 | .replacingOccurrences(of: "", with: "HTML") 334 | .replacingOccurrences(of: "", with: emailValidBody) 335 | .replacingOccurrences(of: "", with: "#microsoft.graph.fileAttachment") 336 | .replacingOccurrences(of: "", with: "image\\/png") 337 | .replacingOccurrences(of: "", with: imageData.base64EncodedString()) 338 | .replacingOccurrences(of: "", with: "me.png") 339 | 340 | return emailPostContent.data(using: .utf8) 341 | } catch { 342 | return nil 343 | } 344 | } 345 | 346 | /** 347 | POSTS a new message to the sendmail resource 348 | - parameters: 349 | - Data: The body of the message 350 | */ 351 | func sendMailRESTWithContent(_ content: Data) { 352 | _ = self.sendCRUDMessage(resource: "microsoft.graph.sendmail", 353 | operation: "POST", 354 | content: content) 355 | } 356 | 357 | /** 358 | Send a create, read, update, delete (CRUD) message. 359 | Create= POST, Update= PUT, Delete= DELETE. 360 | Read= GET. Use sendGETMessage(resource: String) to read Graph contents 361 | - returns: 362 | JSON response as Data 363 | - parameters: 364 | - String: The REST resource receiving the CRUD request 365 | - String: the REST operation requested 366 | - Data: The json (as Data) representing the values to update 367 | */ 368 | func sendCRUDMessage(resource: String, operation: String, content: Data) -> Promise { 369 | let sendRequest: Promise 370 | 371 | switch operation { 372 | case "GET": 373 | sendRequest = self.sendGETMessage(resource: resource) 374 | default: 375 | let request = self.buildRequest(operation: operation, resource: resource, withBody: content) 376 | 377 | sendRequest = Promise { resolver in 378 | URLSession.shared.dataTask(with: request) { data, res, err in 379 | if let err = err { 380 | self.updateUI(showActivityIndicator: false, 381 | statusText: "Error assembling the mail content. " + err.localizedDescription, 382 | sendMail: false) 383 | resolver.reject(err) 384 | return 385 | } 386 | 387 | switch self.checkResult(result: res!) { 388 | case .noError: 389 | self.updateUI(showActivityIndicator: false, 390 | statusText: "Email Sent!", 391 | sendMail: true) 392 | resolver.fulfill(data!) 393 | default: 394 | self.updateUI(showActivityIndicator: false, 395 | statusText: "Error sending the mail.", sendMail: false) 396 | resolver.reject(HTTPError.invalidRequest) 397 | } 398 | }.resume() 399 | } 400 | } 401 | 402 | return firstly { connectToGraph() } 403 | .then { _ in sendRequest } 404 | } 405 | 406 | /** 407 | Creates an URLRequest with the operation and resource parameters 408 | 409 | - returns: 410 | - NSURLRequest 411 | */ 412 | func buildRequest(operation: String, resource: String, withBody: Data? = nil) -> URLRequest { 413 | var request = URLRequest(url: URL(string: "https://graph.microsoft.com/v1.0/me/\(resource)")!) 414 | request.httpMethod = operation 415 | request.httpBody = withBody 416 | request.setValue("application/json", forHTTPHeaderField: "Content-Type") 417 | request.setValue("application/json, text/plain, */*", forHTTPHeaderField: "Accept") 418 | 419 | let accessToken = AuthenticationClass.sharedInstance.accessToken 420 | request.setValue("Bearer \(accessToken)" as String, forHTTPHeaderField: "Authorization") 421 | return request 422 | } 423 | 424 | /** 425 | Sends a GET request. Internal helper method is only called by SendCRUDRequest() 426 | 427 | - returns: 428 | Data. The response returned by the GET request 429 | - parameters: 430 | - String: The resource to request the GET operation on 431 | */ 432 | func sendGETMessage(resource: String) -> Promise { 433 | let request = self.buildRequest(operation: "GET", resource: resource) 434 | return Promise { resolver in 435 | URLSession.shared.dataTask(with: request) { data, response, error in 436 | if let error = error { 437 | resolver.reject(error) 438 | self.updateUI(showActivityIndicator: false, statusText: self.failureString, sendMail: false) 439 | return 440 | } 441 | 442 | let statusCode = (response as? HTTPURLResponse)?.statusCode ?? 400 443 | 444 | switch statusCode { 445 | case 200...299: 446 | self.updateUI(showActivityIndicator: false, statusText: self.successString, sendMail: true) 447 | resolver.fulfill(data!) 448 | default: 449 | print("response: \(response!)") 450 | print(String(data: data!, encoding: String.Encoding.utf8) as Any ) 451 | self.updateUI(showActivityIndicator: false, statusText: self.failureString, sendMail: false) 452 | resolver.reject(error ?? HTTPError.invalidRequest) 453 | } 454 | }.resume() 455 | } 456 | } 457 | 458 | /** 459 | Calls into the AuthenticationClass to get an access token for the user. 460 | Authentication class handles the mechanics of authenticating the user. 461 | - returns: 462 | True if the user is authenticated and an access token is returned. 463 | */ 464 | func connectToGraph() -> Promise { 465 | return Promise { resolver in 466 | // Acquire an access token. If logged in already, this shouldn't bring up an authentication window. 467 | // However, if the token is expired, user will be asked to sign in again. 468 | AuthenticationClass.sharedInstance 469 | .connectToGraph(scopes: ApplicationConstants.kScopes) { error, accessToken in 470 | if let error = error { 471 | let errorMessage = ApplicationConstants.MSGraphError 472 | .nsErrorType(error: error as NSError).localizedDescription 473 | let alertController = UIAlertController(title: "Error", 474 | message: errorMessage, 475 | preferredStyle: .alert) 476 | 477 | alertController.addAction(UIAlertAction(title: "Close", style: .destructive) { _ in 478 | AuthenticationClass.sharedInstance.disconnect() 479 | self.navigationController!.popViewController(animated: true) 480 | }) 481 | 482 | self.present(alertController, animated: true, completion: nil) 483 | 484 | resolver.reject(error) 485 | } 486 | 487 | resolver.fulfill(accessToken) 488 | } 489 | } 490 | } 491 | 492 | func updateUI(showActivityIndicator: Bool, 493 | statusText: String? = nil, sendMail: Bool) { 494 | DispatchQueue.main.async { 495 | self.statusTextView.text = statusText ?? "" 496 | self.sendMailButton.isEnabled = !showActivityIndicator 497 | showActivityIndicator ? self.activityIndicator.startAnimating() 498 | : self.activityIndicator.stopAnimating() 499 | } 500 | } 501 | } 502 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '11.0' 3 | use_frameworks! 4 | target 'O365-iOS-Microsoft-Graph-Connect-Swift' do 5 | pod 'PromiseKit' 6 | pod 'MSAL', '~> 0.4.0' 7 | end 8 | 9 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MSAL (0.4.2): 3 | - MSAL/app-lib (= 0.4.2) 4 | - MSAL/app-lib (0.4.2) 5 | - PromiseKit (6.4.0): 6 | - PromiseKit/CorePromise (= 6.4.0) 7 | - PromiseKit/Foundation (= 6.4.0) 8 | - PromiseKit/UIKit (= 6.4.0) 9 | - PromiseKit/CorePromise (6.4.0) 10 | - PromiseKit/Foundation (6.4.0): 11 | - PromiseKit/CorePromise 12 | - PromiseKit/UIKit (6.4.0): 13 | - PromiseKit/CorePromise 14 | 15 | DEPENDENCIES: 16 | - MSAL (~> 0.4.0) 17 | - PromiseKit 18 | 19 | SPEC REPOS: 20 | https://github.com/cocoapods/specs.git: 21 | - MSAL 22 | - PromiseKit 23 | 24 | SPEC CHECKSUMS: 25 | MSAL: 2e6bbd12e9629103d92b1f6b1539260ee6d4f82c 26 | PromiseKit: ae3616f45d7bb9bf4ff1e91abc9b7a8c48a340e0 27 | 28 | PODFILE CHECKSUM: e866a94960d9faebf4f4fea7403fd31a537eea68 29 | 30 | COCOAPODS: 1.6.1 31 | -------------------------------------------------------------------------------- /README-Localized/README-de-de.md: -------------------------------------------------------------------------------- 1 | # Microsoft Office 365 Connect-Beispiel für iOS unter Verwendung von Microsoft Graph (Swift) 2 | 3 | Für die Arbeit mit Microsoft Office 365-Diensten und -Daten muss jede iOS-App zunächst eine Verbindung zu Microsoft Office 365 herstellen. In diesem Beispiel wird gezeigt, wie die Verbindung zu und dann der Aufruf einer API über Microsoft Graph (wurde zuvor als vereinheitlichte Office 365-API bezeichnet) erfolgt. 4 | 5 | > Hinweis: Die Objective-C-Version dieses Beispiels finden Sie unter [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect). Rufen Sie die Seite [Erste Schritte mit Office 365-APIs](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup) auf. Auf dieser wird die Registrierung vereinfacht, damit Sie dieses Beispiel schneller ausführen können. 6 | 7 | ## Voraussetzungen 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) von Apple 9 | * Installation von [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) als ein Abhängigkeits-Manager. 10 | * Ein Office 365-Konto. Sie können sich für ein [Office 365-Entwicklerabonnement](https://aka.ms/devprogramsignup) registrieren, das alle Ressourcen umfasst, die Sie zum Einstieg in die Entwicklung von Office 365-Apps benötigen. 11 | 12 | > Hinweis: Wenn Sie bereits über ein Abonnement verfügen, gelangen Sie über den vorherigen Link zu einer Seite mit der Meldung „Leider können Sie Ihrem aktuellen Konto diesen Inhalt nicht hinzufügen“. Verwenden Sie in diesem Fall ein Konto aus Ihrem aktuellen Office 365-Abonnement. 13 | * Ein Microsoft Azure-Mandant zum Registrieren Ihrer Anwendung. Von Microsoft Azure Active Directory (AD) werden Identitätsdienste bereitgestellt, die durch Anwendungen für die Authentifizierung und Autorisierung verwendet werden. Hier kann ein Testabonnement erworben werden: [Microsoft Azure](https://account.windowsazure.com/SignUp) 14 | 15 | > Wichtig: Sie müssen zudem sicherstellen, dass Ihr Azure-Abonnement an Ihren Office 365-Mandanten gebunden ist. Rufen Sie dafür den Blogpost [Creating and Managing Multiple Windows Azure Active Directories](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx) des Active Directory-Teams auf. In diesem Beitrag finden Sie unter **Adding a new directory** Informationen über die entsprechende Vorgehensweise. Weitere Informationen finden Sie zudem unter [Einrichten Ihrer Office 365-Entwicklungsumgebung](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription) im Abschnitt **Verknüpfen Ihres Office 365-Kontos mit Azure AD zum Erstellen und Verwalten von Apps**. 16 | 17 | * Eine Client-ID und Umleitungs-URI-Werte einer in Azure registrierten Anwendung. Dieser Beispielanwendung muss die Berechtigung **E-Mails unter einem anderen Benutzernamen senden** für **Microsoft Graph** gewährt werden. Informationen über das Erstellen der Registrierung finden Sie unter **Registrieren der systemeigenen App mit dem Azure-Verwaltungsportal** in [Manuelles Registrieren der App mit Azure AD, damit sie auf Office 365-APIs zugreifen kann](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually), und [gewähren Sie die entsprechenden Berechtigungen](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure) im Beispiel-Wiki, um die entsprechenden Berechtigungen darauf anzuwenden. 18 | 19 | 20 | 21 | ## Ausführen dieses Beispiels in Xcode 22 | 23 | 1. Klonen Sie dieses Repository 24 | 2. Verwenden Sie CocoaPods zum Importieren der Abhängigkeit zwischen Active Directory Authentication Library (ADAL) und iOS: 25 | 26 | pod 'ADALiOS', '= 1.2.4' 27 | 28 | Diese Beispiel-App enthält bereits eine POD-Datei, die die ADAL-Komponenten (pods) in das Projekt überträgt. Navigieren Sie einfach über das **Terminal** zum Projekt, und führen Sie Folgendes aus: 29 | 30 | pod install 31 | 32 | Weitere Informationen finden Sie im Thema über das **Verwenden von CocoaPods** in [Zusätzliche Ressourcen](#AdditionalResources). 33 | 34 | 3. Öffnen Sie **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace**. 35 | 4. Öffnen Sie **AuthenticationConstants.swift**. Sie können sehen, dass die Werte **ClientID** und **RedirectUri** oben in der Datei hinzugefügt werden können. Geben Sie hier die erforderlichen Werte an: 36 | 37 | // You will set your application's clientId and redirect URI. 38 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 39 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 40 | static let Authority = "https://login.microsoftonline.com/common" 41 | static let ResourceId = "https://graph.microsoft.com" 42 | 43 | > Hinweis: Wenn Sie weder über „CLIENT_ID“- noch über „REDIRECT_URI“-Werte verfügen, müssen Sie [eine native Clientanwendung in Azure hinzufügen](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding) und sich die Werte „CLIENT_ID“ und „REDIRECT_URI“ notieren. 44 | 45 | 5. Führen Sie das Beispiel aus. 46 | 47 | 48 | ## Fragen und Kommentare 49 | 50 | Wir schätzen Ihr Feedback hinsichtlich des Office 365 iOS Microsoft Graph Connect Swift-Projekts. Sie können uns Ihre Fragen und Vorschläge über den Abschnitt [Probleme](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues) dieses Repositorys senden. 51 | 52 | Allgemeine Fragen zur Office 365-Entwicklung sollten in [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API) gestellt werden. Stellen Sie sicher, dass Ihre Fragen oder Kommentare mit [Office365] und [MicrosoftGraph] markiert sind. 53 | 54 | 55 | ## Zusätzliche Ressourcen 56 | 57 | * [Office Dev Center](http://dev.office.com/) 58 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 59 | * [Microsoft Graph-Übersichtsseite](https://graph.microsoft.io) 60 | * [Verwenden von CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 61 | 62 | ## Copyright 63 | Copyright (c) 2016 Microsoft. Alle Rechte vorbehalten. 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /README-Localized/README-es-es.md: -------------------------------------------------------------------------------- 1 | # Ejemplo Connect de Microsoft Office 365 para iOS con Microsoft Graph (Swift) 2 | 3 | Conectarse a Microsoft Office 365 es el primer paso que debe realizar cada aplicación iOS para empezar a trabajar con los datos y servicios de Office 365. Este ejemplo muestra cómo conectar y cómo llamar después a una API mediante Microsoft Graph (anteriormente denominada API unificada de Office 365). 4 | 5 | > Nota: Para ver la versión para Objective-C de este ejemplo, consulte [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect). Adicionalmente, consulte [Introducción a las API de Office 365](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup), que simplifica el registro para que este ejemplo se ejecute más rápidamente. 6 | 7 | ## Requisitos previos 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) de Apple 9 | * Instalación de [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como administrador de dependencias. 10 | * Una cuenta de Office 365. Puede registrarse para obtener [una suscripción a Office 365 Developer](https://aka.ms/devprogramsignup), que incluye los recursos que necesita para empezar a compilar aplicaciones de Office 365. 11 | 12 | > Nota: Si ya dispone de una suscripción, el vínculo anterior le dirige a una página con el mensaje *No se puede agregar a su cuenta actual*. En ese caso, use una cuenta de su suscripción actual a Office 365.Mic 13 | * Un inquilino de Microsoft Azure para registrar la aplicación. Microsoft Azure Active Directory (AD) proporciona servicios de identidad que las aplicaciones usan para autenticación y autorización. Puede adquirir una suscripción de prueba aquí: [Microsoft Azure](https://account.windowsazure.com/SignUp). 14 | 15 | > Importante: También necesitará asegurarse de que su suscripción a Azure esté enlazada a su inquilino de Office 365. Para ello, consulte la publicación del blog del equipo de Active Directory [Crear y administrar varios directorios de Windows Azure Active Directory](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx). La sección **Agregar un nuevo directorio** le explicará cómo hacerlo. Para obtener más información, también puede consultar [Configurar el entorno de desarrollo de Office 365](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription) y la sección **Asociar su cuenta de Office 365 con Azure AD para crear y administrar aplicaciones**. 16 | 17 | * Los valores de identificador de cliente y URI de redireccionamiento de una aplicación registrada en Azure. A esta aplicación de ejemplo se le debe conceder el permiso **Enviar correo como usuario** para **Microsoft Graph**. Para crear el registro, consulte **Registrar la aplicación nativa con el Portal de administración de Azure** en [Registrar manualmente la aplicación con Azure AD para que pueda acceder a las API de Office 365](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually) y [conceder permisos adecuados](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure) en la wiki de ejemplo para aplicarle los permisos adecuados. 18 | 19 | 20 | 21 | ## Ejecutar este ejemplo en Xcode 22 | 23 | 1. Clone este repositorio. 24 | 2. Use CocoaPods para importar la dependencia iOS de la biblioteca de autenticación de Active Directory (ADAL): 25 | 26 | pod 'ADALiOS', '= 1.2.4' 27 | 28 | Esta aplicación de ejemplo ya contiene un podfile que recibirá los componentes ADAL (pods) en el proyecto. Simplemente vaya al proyecto desde **Terminal** y ejecute: 29 | 30 | pod install 31 | 32 | Para obtener más información, consulte **Usar CocoaPods** en [Recursos adicionales](#AdditionalResources) 33 | 34 | 3. Abra **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace**. 35 | 4. Abra **AuthenticationConstants.swift**. Verá que los valores **ClientID** y **RedirectUri** pueden agregarse en la parte superior del archivo. Proporcione los valores necesarios aquí: 36 | 37 | // You will set your application's clientId and redirect URI. 38 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 39 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 40 | static let Authority = "https://login.microsoftonline.com/common" 41 | static let ResourceId = "https://graph.microsoft.com" 42 | 43 | > Nota: Si no dispone de los valores CLIENT_ID y REDIRECT_URI, [agregue una aplicación de cliente nativa en Azure](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding) y anote los valores CLIENT_ID y REDIRECT_URI. 44 | 45 | 5. Ejecute el ejemplo. 46 | 47 | 48 | ## Preguntas y comentarios 49 | 50 | Nos encantaría recibir sus comentarios sobre el proyecto Connect de Office 365 para iOS con Microsoft Graph (Swift). Puede enviarnos sus preguntas y sugerencias a través de la sección [Problemas](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues) de este repositorio. 51 | 52 | Las preguntas generales sobre desarrollo en Office 365 deben publicarse en [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Asegúrese de que sus preguntas o comentarios se etiquetan con [Office365] y [MicrosoftGraph]. 53 | 54 | 55 | ## Recursos adicionales 56 | 57 | * [Centro para desarrolladores de Office](http://dev.office.com/) 58 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 59 | * [Página de información general de Microsoft Graph](https://graph.microsoft.io) 60 | * [Usar CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 61 | 62 | ## Copyright 63 | Copyright (c) 2016 Microsoft. Todos los derechos reservados. 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /README-Localized/README-fr-fr.md: -------------------------------------------------------------------------------- 1 | # Exemple de connexion d’iOS à Microsoft Office 365 avec Microsoft Graph (Swift) 2 | 3 | La connexion à Microsoft Office 365 est la première étape que chaque application iOS doit suivre pour commencer à travailler avec les données et services Office 365. Cet exemple explique comment connecter, puis appeler une API via Microsoft Graph (anciennement appelé API unifiée Office 365). 4 | 5 | > Remarque : pour la version Objective-C de cet exemple, voir [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect). Consultez également la page relative à la [prise en main des API Office 365](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup) pour enregistrer plus facilement votre application et exécuter plus rapidement cet exemple. 6 | 7 | ## Conditions requises 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) d’Apple 9 | * Installation de [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) comme gestionnaire de dépendances. 10 | * Un compte Office 365. Vous pouvez souscrire à [un abonnement Office 365 Développeur](https://aka.ms/devprogramsignup) comprenant les ressources dont vous avez besoin pour commencer à créer des applications Office 365. 11 | 12 | > Remarque : si vous avez déjà un abonnement, le lien précédent vous renvoie vers une page avec le message suivant : « Désolé, vous ne pouvez pas ajouter ceci à votre compte existant ». Dans ce cas, utilisez un compte lié à votre abonnement Office 365 existant. 13 | * Un client Microsoft Azure pour enregistrer votre application. Microsoft Azure Active Directory (AD) fournit des services d’identité que les applications utilisent à des fins d’authentification et d’autorisation. Un abonnement d’évaluation peut être demandé ici : [Microsoft Azure](https://account.windowsazure.com/SignUp). 14 | 15 | > Important : vous devrez également vous assurer que votre abonnement Azure est lié à votre client Office 365. Pour cela, consultez le billet du blog de l’équipe d’Active Directory relatif à la [création et la gestion de plusieurs fenêtres dans les répertoires Azure Active Directory](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx). La section sur l’**ajout d’un nouveau répertoire** vous explique comment procéder. Pour en savoir plus, vous pouvez également consulter la rubrique relative à la [configuration de votre environnement de développement Office 365](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription) et la section sur l’**association de votre compte Office 365 à Azure Active Directory pour créer et gérer des applications**. 16 | 17 | * Un ID client et des valeurs d’URI de redirection d’une application enregistrée dans Azure. Cet exemple d’application doit obtenir l’autorisation **Envoyer un courrier électronique en tant qu’utilisateur** pour **Microsoft Graph**. Pour enregistrer votre application, consultez la section relative à l’**enregistrement d’une application native avec le portail de gestion Azure** dans la rubrique relative à l’[enregistrement manuel d’une application avec Azure AD pour accéder aux API Office 365](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually) et la page relative à l’[octroi d’autorisations appropriées](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure) dans le wiki pour lui accorder les autorisations appropriées. 18 | 19 | 20 | 21 | ## Exécution de cet exemple dans Xcode 22 | 23 | 1. Cloner ce référentiel 24 | 2. Utilisez CocoaPods pour importer la dépendance iOS Active Directory Authentication Library (ADAL) : 25 | 26 | pod 'ADALiOS', '= 1.2.4' 27 | 28 | Cet exemple d’application contient déjà un podfile qui recevra les composants ADAL (pods) dans le projet. Ouvrez simplement le projet à partir de **Terminal** et exécutez : 29 | 30 | pod install 31 | 32 | Pour plus d’informations, consultez **Utilisation de CocoaPods** dans [Ressources supplémentaires](#AdditionalResources) 33 | 34 | 3. Ouvrez **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 35 | 4. Ouvrez **AuthenticationConstants.swift**. Vous verrez que les valeurs **ClientID** et **RedirectUri** peuvent être ajoutées en haut du fichier. Indiquez les valeurs requises ici : 36 | 37 | // You will set your application's clientId and redirect URI. 38 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 39 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 40 | static let Authority = "https://login.microsoftonline.com/common" 41 | static let ResourceId = "https://graph.microsoft.com" 42 | 43 | > Remarque : si vous ne connaissez pas les valeurs de CLIENT_ID et de REDIRECT_URI, [ajoutez une application cliente native dans Azure](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding) pour les noter. 44 | 45 | 5. Exécutez l’exemple. 46 | 47 | 48 | ## Questions et commentaires 49 | 50 | Nous serions ravis de connaître votre opinion sur le projet Swift de connexion d’iOS à Office 365 avec Microsoft Graph. Vous pouvez nous faire part de vos questions et suggestions dans la rubrique [Problèmes](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues) de ce référentiel. 51 | 52 | Si vous avez des questions sur le développement d’Office 365, envoyez-les sur [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Veillez à poser vos questions ou à rédiger vos commentaires avec les tags [MicrosoftGraph] et [Office 365]. 53 | 54 | 55 | ## Ressources supplémentaires 56 | 57 | * [Centre de développement Office](http://dev.office.com/) 58 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 59 | * [Page de présentation de Microsoft Graph](https://graph.microsoft.io) 60 | * [Utilisation de CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 61 | 62 | ## Copyright 63 | Copyright (c) 2016 Microsoft. Tous droits réservés. 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /README-Localized/README-ja-jp.md: -------------------------------------------------------------------------------- 1 | # Microsoft Graph (Swift) を使った iOS 用 Microsoft Office 365 Connect サンプル 2 | 3 | Office 365 への接続は、各 iOS アプリが Microsoft Office 365 のサービスおよびデータの操作を開始するために必要な最初の手順です。このサンプルは、Microsoft Graph (旧称 Office 365 統合 API) を介して、1 つの API に接続して呼び出す方法を示しています。 4 | 5 | > 注:このサンプルの Objective-C バージョンについては、「[O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect)」をご覧ください。また、このサンプルをより迅速に実行するため、「[Office 365 API を使う](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup)」ページに記載された登録の簡略化もお試しください。 6 | 7 | ## 前提条件 8 | * 9 | Apple 社の [Xcode](https://developer.apple.com/xcode/downloads/)。 10 | * 依存関係マネージャーとしての [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) のインストール。 11 | * Office 365 アカウント。[Office 365 Developer](https://aka.ms/devprogramsignup) サブスクリプションにサイン アップすることができます。ここには、Office 365 アプリのビルドを開始するために必要なリソースが含まれています。 12 | 13 | > 注: サブスクリプションが既に存在する場合、上記のリンクをクリックすると、*申し訳ありません、現在のアカウントに追加できません* と表示されたページに移動します。その場合は、現在使用している Office 365 サブスクリプションのアカウントをご利用いただけます。Mic 14 | * アプリケーションを登録する Microsoft Azure テナント。Microsoft Azure Active Directory (AD) は、アプリケーションが認証と承認に使用する ID サービスを提供します。試用版サブスクリプションは、[Microsoft Azure](https://account.windowsazure.com/SignUp) で取得できます。 15 | 16 | > 重要事項:Azure サブスクリプションが Office 365 テナントにバインドされていることを確認する必要があります。確認するには、Active Directory チームのブログ投稿「[複数の Windows Azure Active Directory を作成および管理する](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx)」を参照してください。「**新しいディレクトリを追加する**」セクションで、この方法について説明しています。また、詳細については、「[Office 365 開発環境をセットアップする](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription)」や「**Office 365 アカウントを Azure AD と関連付けてアプリを作成および管理する**」セクションも参照してください。 17 | 18 | * Azure に登録されたアプリケーションのクライアント ID とリダイレクト URI の値。このサンプル アプリケーションには、**Microsoft Graph** の**ユーザーとしてメールを送信する**アクセス許可を付与する必要があります。登録を作成するには、「[Office 365 API にアクセスできるようにアプリを Azure AD に手動で登録する](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually)」の「**Azure 管理ポータルにネイティブ アプリを登録する**」と、適切なアクセス許可を付与するためのサンプル Wiki の「[適切なアクセス許可を付与する](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure)」をご覧ください。 19 | 20 | 21 | 22 | ## Xcode でこのサンプルを実行する 23 | 24 | 1. このリポジトリの複製を作成する 25 | 2. CocoaPods を使って、Active Directory 認証ライブラリ (ADAL) iOS の依存関係をインポートします。 26 | 27 | pod 'ADALiOS', '= 1.2.4' 28 | 29 | このサンプル アプリには、プロジェクトに ADAL コンポーネント (pods) を取り込む podfile がすでに含まれています。**ターミナル**からプロジェクトに移動して次を実行するだけです。 30 | 31 | pod install 32 | 33 | 詳しくは、[その他の技術情報](#AdditionalResources)の「**CocoaPods を使う**」をご覧ください。 34 | 35 | 3. **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** を開きます。 36 | 4. **AuthenticationConstants.swift** を開きます。**ClientID** と **RedirectUri** の各値がファイルの一番上に追加されていることが分かります。ここで必要な値を指定します。 37 | 38 | // You will set your application's clientId and redirect URI. 39 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 40 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 41 | static let Authority = "https://login.microsoftonline.com/common" 42 | static let ResourceId = "https://graph.microsoft.com" 43 | 44 | > 注: CLIENT_ID と REDIRECT_URI の値がない場合は、[ネイティブ クライアント アプリケーションを Azure に追加](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding)し、CLIENT_ID と REDIRECT_URI を書き留めます。 45 | 46 | 5. サンプルを実行します。 47 | 48 | 49 | ## 質問とコメント 50 | 51 | Office 365 iOS Microsoft Graph Connect Swift プロジェクトについて、Microsoft にフィードバックをお寄せください。質問や提案につきましては、このリポジトリの「[問題](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues)」セクションに送信できます。 52 | 53 | Office 365 開発全般の質問につきましては、「[スタック オーバーフロー](http://stackoverflow.com/questions/tagged/Office365+API)」に投稿してください。質問またはコメントには、必ず [Office365] および [MicrosoftGraph] のタグを付けてください。 54 | 55 | 56 | ## その他の技術情報 57 | 58 | * [Office デベロッパー センター](http://dev.office.com/) 59 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 60 | * [Microsoft Graph 概要ページ](https://graph.microsoft.io) 61 | * [CocoaPods を使う](https://guides.cocoapods.org/using/using-cocoapods.html) 62 | 63 | ## 著作権 64 | Copyright (c) 2016 Microsoft. All rights reserved. 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README-Localized/README-pt-br.md: -------------------------------------------------------------------------------- 1 | # Exemplo de conexão com o Microsoft Office 365 para iOS usando o Microsoft Graph (Swift) 2 | 3 | A primeira etapa para que os aplicativos iOS comecem a funcionar com dados e serviços do Microsoft Office 365 é estabelecer uma conexão com essa plataforma. Este exemplo mostra como se conectar e chamar uma única API do Microsoft Graph (antiga API unificada do Office 365). 4 | 5 | > Observação: Para a versão Objective-C deste exemplo, confira [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect). Além disso, experimente a página [Introdução às APIs do Office 365](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup), que simplifica o registro para que você possa executar esse exemplo com mais rapidez. 6 | 7 | ## Pré-requisitos 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) da Apple 9 | * A instalação do [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como um gerenciador de dependências. 10 | * Uma conta do Office 365. Você pode se inscrever para [uma assinatura do Office 365 Developer](https://aka.ms/devprogramsignup), que inclui os recursos de que você precisa para começar a criar aplicativos do Office 365. 11 | 12 | > Observação: Caso já tenha uma assinatura, o link anterior direciona você para uma página com a mensagem *Não é possível adicioná-la à sua conta atual*. Nesse caso, use uma conta de sua assinatura atual do Office 365. 13 | * Um locatário do Microsoft Azure para registrar o seu aplicativo. O Microsoft Azure Active Directory (AD) fornece serviços de identidade que os aplicativos usam para autenticação e autorização. Você pode adquirir uma assinatura de avaliação aqui: [Microsoft Azure](https://account.windowsazure.com/SignUp). 14 | 15 | > Importante: Você também deve assegurar que a sua assinatura do Azure esteja vinculada ao locatário do Office 365. Para saber como fazer isso, confira a postagem de blog da equipe do Active Directory: [Criar e gerenciar vários Microsoft Azure Active Directory](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx). A seção **Adicionar um novo diretório** explica como fazer isso. Para saber mais, confira o artigo [Configurar o seu ambiente de desenvolvimento do Office 365](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription) e a seção **Associar a sua conta do Office 365 ao Azure AD para criar e gerenciar aplicativos**. 16 | 17 | * Valores de ID do cliente e de URI de redirecionamento de um aplicativo registrado no Azure. Esse aplicativo de exemplo deve receber permissão para **Enviar email como usuário** para o **Microsoft Graph**. Para criar o registro, confira o tópico **Registrar o aplicativo nativo com o Portal de Gerenciamento do Azure**, no artigo [Registrar o aplicativo manualmente com o AD do Azure para que ele possa acessar as APIs do Office 365](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually) e [conceda as permissões adequadas](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure) na wiki de exemplo para aplicá-las no registro. 18 | 19 | 20 | 21 | ## Executar esse exemplo no Xcode 22 | 23 | 1. Clonar esse repositório 24 | 2. Use o CocoaPods para importar a dependência de iOS da ADAL (Biblioteca de Autenticação do Active Directory): 25 | 26 | pod 'ADALiOS', '= 1.2.4' 27 | 28 | Esse exemplo de aplicativo já contém um podfile que receberá os componentes ADAL (pods) no projeto. Basta navegar para o projeto no **Terminal** e executar: 29 | 30 | pod install 31 | 32 | Para saber mais, confira o artigo **Usar o CocoaPods** em [Recursos adicionais](#AdditionalResources) 33 | 34 | 3. Abra **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 35 | 4. Abra **AuthenticationConstants.swift**. Observe que você pode adicionar os valores de **ClientID** e **RedirectUri** na parte superior do arquivo. Forneça os valores necessários aqui: 36 | 37 | // You will set your application's clientId and redirect URI. 38 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 39 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 40 | static let Authority = "https://login.microsoftonline.com/common" 41 | static let ResourceId = "https://graph.microsoft.com" 42 | 43 | > Observação: Caso não tenha os valores CLIENT_ID e REDIRECT_URI, [adicione um aplicativo cliente nativo no Azure](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding) e anote os valores de CLIENT\_ID e de REDIRECT_URI. 44 | 45 | 5. Execute o exemplo. 46 | 47 | 48 | ## Perguntas e comentários 49 | 50 | Gostaríamos de saber sua opinião sobre o projeto Swift de conexão com o Office 365 para iOS usando o Microsoft Graph. Você pode enviar perguntas e sugestões na seção [Problemas](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues) deste repositório. 51 | 52 | As perguntas sobre o desenvolvimento do Office 365 em geral devem ser postadas no [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Não deixe de marcar as perguntas ou comentários com [Office365] e [MicrosoftGraph]. 53 | 54 | 55 | ## Recursos adicionais 56 | 57 | * [Centro de Desenvolvimento do Office](http://dev.office.com/) 58 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 59 | * [Página de visão geral do Microsoft Graph](https://graph.microsoft.io) 60 | * [Usar o CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 61 | 62 | ## Direitos autorais 63 | Copyright © 2016 Microsoft. Todos os direitos reservados. 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /README-Localized/README-ru-ru.md: -------------------------------------------------------------------------------- 1 | # Пример приложения на Swift для iOS, подключающегося к Microsoft Office 365 и использующего Microsoft Graph 2 | 3 | Подключение к Microsoft Office 365 — это первый шаг, который должно выполнить каждое приложение для iOS, чтобы начать работу со службами и данными Office 365. В этом примере показано, как подключить и вызвать один API с помощью Microsoft Graph (прежнее название — единый API Office 365). 4 | 5 | > Примечание. Версию Objective-C этого примера см. в статье [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect). Кроме того, перейдите на страницу [Начало работы с API Office 365](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup) для упрощенной регистрации, чтобы ускорить запуск этого примера. 6 | 7 | ## Необходимые условия 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) от Apple. 9 | * Установка [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) в качестве диспетчера зависимостей. 10 | * Учетная запись Office 365. Вы можете [подписаться на план Office 365 для разработчиков](https://aka.ms/devprogramsignup) включающий ресурсы, которые необходимы для создания приложений Office 365. 11 | 12 | > Примечание. Если у вас уже есть подписка, при выборе приведенной выше ссылки откроется страница с сообщением *К сожалению, вы не можете добавить это к своей учетной записи*. В этом случае используйте учетную запись, сопоставленную с текущей подпиской на Office 365. 13 | * Клиент Microsoft Azure для регистрации приложения. В Microsoft Azure Active Directory (AD) доступны службы удостоверений, которые приложения используют для проверки подлинности и авторизации. Здесь можно получить пробную подписку: [Microsoft Azure](https://account.windowsazure.com/SignUp). 14 | 15 | > Важно! Убедитесь, что ваша подписка Azure привязана к клиенту Office 365. Для этого просмотрите запись в блоге команды Active Directory, посвященную [созданию нескольких каталогов Microsoft Azure AD и управлению ими](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx). Инструкции приведены в разделе о **добавлении нового каталога**. Дополнительные сведения см. в статье [Как настроить среду разработки для Office 365](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription) и, в частности, в разделе **Связывание Azure AD и учетной записи Office 365 для создания приложений и управления ими**. 16 | 17 | * Универсальный код ресурса (URI) для перенаправления и идентификатор клиента, указанные при регистрации приложения в Azure. Этому приложению необходимо предоставить разрешение **Отправка почты от имени пользователя** для **Microsoft Graph**. Указания по регистрации см. в разделе **Регистрация основного приложения на портале управления Azure** статьи [Регистрация приложения в Azure AD вручную, чтобы оно могло получить доступ к API Office 365](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually). Кроме того, см. инструкции по [предоставлению необходимых разрешений](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure) на соответствующей вкладке вики-статьи. 18 | 19 | 20 | 21 | ## Запуск этого примера в Xcode 22 | 23 | 1. Клонируйте этот репозиторий. 24 | 2. С помощью CocoaPods импортируйте зависимость iOS из библиотеки проверки подлинности Active Directory (ADAL): 25 | 26 | pod 'ADALiOS', '= 1.2.4' 27 | 28 | Этот пример приложения уже содержит компонент podfile, который добавит компоненты ADAL (pod) в проект. Просто перейдите к проекту из раздела **Терминал** и выполните следующую команду: 29 | 30 | pod install 31 | 32 | Для получения дополнительных сведений выберите ссылку **Использование CocoaPods** в разделе [Дополнительные ресурсы](#AdditionalResources). 33 | 34 | 3. Откройте **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 35 | 4. Откройте файл **AuthenticationConstants.swift**. Вы увидите, что значения **ClientID** и **RedirectUri** можно добавить в верхнюю часть файла. Введите здесь все необходимые значения: 36 | 37 | // You will set your application's clientId and redirect URI. 38 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 39 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 40 | static let Authority = "https://login.microsoftonline.com/common" 41 | static let ResourceId = "https://graph.microsoft.com" 42 | 43 | > Примечание. Если у вас нет значений CLIENT_ID и REDIRECT_URI, [добавьте основное клиентское приложение в Azure](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding), а затем запишите CLIENT_ID и REDIRECT_URI. 44 | 45 | 5. Запустите приложение. 46 | 47 | 48 | ## Вопросы и комментарии 49 | 50 | Мы будем рады получить от вас отзывы о проекте приложения на Swift для iOS, подключающегося к Office 365 и использующего Microsoft Graph. Вы можете отправлять нам вопросы и предложения в разделе [Issues](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues) этого репозитория. 51 | 52 | Общие вопросы о разработке решений для Office 365 следует публиковать на сайте [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Обязательно помечайте свои вопросы и комментарии тегами [Office365] и [MicrosoftGraph]. 53 | 54 | 55 | ## Дополнительные ресурсы 56 | 57 | * [Центр разработки для Office](http://dev.office.com/) 58 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 59 | * [Страница с общими сведениями о Microsoft Graph](https://graph.microsoft.io) 60 | * [Использование CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 61 | 62 | ## Авторское право 63 | (c) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены. 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /README-Localized/README-zh-cn.md: -------------------------------------------------------------------------------- 1 | # 使用 Microsoft Graph (Swift) 的 iOS Microsoft Office 365 Connect 示例 2 | 3 | 连接到 Microsoft Office 365 是每个 iOS 应用开始使用 Office 365 服务和数据必须采取的第一步。该示例演示如何通过 Microsoft Graph(旧称 Office 365 统一 API)连接并调用一个 API。 4 | 5 | > 注意:有关此示例的 Objective-C 版本,请参阅 [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect)。此外,请尝试 [Office 365 API 入门](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup)页面,其简化了注册,使您可以更快地运行该示例。 6 | 7 | ## 先决条件 8 | * 9 | Apple [Xcode](https://developer.apple.com/xcode/downloads/) 10 | * 安装 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 成为依存关系管理器。 11 | * Office 365 帐户。您可以注册 [Office 365 开发人员订阅](https://aka.ms/devprogramsignup),其中包含开始构建 Office 365 应用所需的资源。 12 | 13 | > 注意:如果您已经订阅,之前的链接会将您转至包含以下信息的页面:*抱歉,您无法将其添加到当前帐户*。在这种情况下,请使用当前 Office 365 订阅中的帐户。Mic 14 | * 用于注册您的应用程序的 Microsoft Azure 租户。Microsoft Azure Active Directory (AD) 为应用程序提供了用于进行身份验证和授权的标识服务。您还可在此处获得试用订阅:[Microsoft Azure](https://account.windowsazure.com/SignUp)。 15 | 16 | > 重要说明:您将还需要确保您的 Azure 订阅已绑定到 Office 365 租户。要执行这一操作,请参阅 Active Directory 团队的博客文章:[创建和管理多个 Microsoft Azure Active Directory](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx)。**添加新目录**一节将介绍如何执行此操作。您还可以参阅[设置 Office 365 开发环境](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription)和**关联您的 Office 365 帐户和 Azure AD 以创建并管理应用**一节获取详细信息。 17 | 18 | * 在 Azure 中注册的应用程序的客户端 ID 和重定向 URI 值。必须向该示例应用程序授予**以用户身份发送邮件**权限以使用 **Microsoft Graph**。要创建注册,请参阅[使用 Azure AD 手动注册应用并使其能够访问 Office 365 API](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually) 中的**使用 Azure 管理门户注册本机应用程序**和示例 wiki 中的[授予适当权限](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure)向其授予适当的权限。 19 | 20 | 21 | 22 | ## 在 Xcode 中运行该示例 23 | 24 | 1. 克隆该存储库 25 | 2. 使用 CocoaPods 导入 Active Directory Authentication Library (ADAL) iOS 依存关系: 26 | 27 | pod 'ADALiOS', '= 1.2.4' 28 | 29 | 该示例应用已经包含了可将 ADAL 组件 (pod) 导入到项目中的 pod 文件。只需从**终端**中导航到该项目并运行: 30 | 31 | pod install 32 | 33 | 更多详细信息,请参阅[其他资源](#AdditionalResources)中的**使用 CocoaPods** 34 | 35 | 3. 打开 **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 36 | 4. 打开 **AuthenticationConstants.swift**。您会发现,**ClientID** 和 **RedirectUri** 值可以添加到文件的顶部。在此提供必须值: 37 | 38 | // You will set your application's clientId and redirect URI. 39 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 40 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 41 | static let Authority = "https://login.microsoftonline.com/common" 42 | static let ResourceId = "https://graph.microsoft.com" 43 | 44 | > 注意:如果您没有 CLIENT_ID 和 REDIRECT_URI 值,请[在 Azure 中添加本机客户端应用程序](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding)并记录 CLIENT\_ID 和 REDIRECT_URI。 45 | 46 | 5. 运行示例。 47 | 48 | 49 | ## 问题和意见 50 | 51 | 我们乐意倾听您有关 Office 365 iOS Microsoft Graph Connect Swift 项目的反馈。您可以在该存储库中的[问题](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues)部分将问题和建议发送给我们。 52 | 53 | 与 Office 365 开发相关的问题一般应发布到[堆栈溢出](http://stackoverflow.com/questions/tagged/Office365+API)。确保您的问题或意见使用了 [Office365] 和 [MicrosoftGraph] 标记。 54 | 55 | 56 | ## 其他资源 57 | 58 | * [Office 开发人员中心](http://dev.office.com/) 59 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 60 | * [Microsoft Graph 概述页](https://graph.microsoft.io) 61 | * [使用 CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 62 | 63 | ## 版权 64 | 版权所有 (c) 2016 Microsoft。保留所有权利。 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README-Localized/README-zh-tw.md: -------------------------------------------------------------------------------- 1 | # 使用 Microsoft Graph (Swift) 的 Microsoft Office 365 Connect 範例 (適用於 iOS) 2 | 3 | 連接到 Microsoft Office 365 是每個 iOS 應用程式要開始使用 Office 365 服務和資料時必須採取的第一個步驟。此範例示範如何透過 Microsoft Graph (之前稱為 Office 365 統一 API) 連接而後呼叫一個 API。 4 | 5 | > 附註:如需此範例的 Objective-C 版本,請參閱 [O365-iOS-Microsoft-Graph-Connect](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect)。此外,嘗試可簡化註冊的 [Office 365 API 入門](http://dev.office.com/getting-started/office365apis?platform=option-ios#setup)頁面,以便您能更快速地執行這個範例。 6 | 7 | ## 必要條件 8 | * 9 | 來自 Apple 的 [Xcode](https://developer.apple.com/xcode/downloads/) 10 | * 安裝 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 做為相依性管理員。 11 | * Office 365 帳戶。您可以註冊 [Office 365 開發人員訂閱](https://aka.ms/devprogramsignup),其中包含在開始建置 Office 365 應用程式時,您所需的資源。 12 | 13 | > 附註:如果您已有訂用帳戶,則先前的連結會讓您連到顯示 *抱歉,您無法將之新增到您目前的帳戶* 訊息的頁面。在此情況下,請使用您目前的 Office 365 訂用帳戶所提供的帳戶。 14 | * 用來註冊您的應用程式的 Microsoft Azure 租用戶。Microsoft Azure Active Directory (AD) 會提供識別服務,以便應用程式用於驗證和授權。在這裡可以取得試用版的訂用帳戶:[Microsoft Azure](https://account.windowsazure.com/SignUp)。 15 | 16 | > 重要事項:您還需要確定您的 Azure 訂用帳戶已繫結至您的 Office 365 租用戶。若要執行這項操作,請參閱 Active Directory 小組的部落格文章:[建立和管理多個 Windows Azure Active Directory](http://blogs.technet.com/b/ad/archive/2013/11/08/creating-and-managing-multiple-windows-azure-active-directories.aspx)。**新增目錄**一節將說明如何執行這項操作。如需詳細資訊,也可以參閱[設定 Office 365 開發環境](https://msdn.microsoft.com/office/office365/howto/setup-development-environment#bk_CreateAzureSubscription)和**建立 Office 365 帳戶與 Azure AD 的關聯以便建立和管理應用程式**一節。 17 | 18 | * 在 Azure 中註冊之應用程式的用戶端識別碼和重新導向 URI 值。此範例應用程式必須取得 **Microsoft Graph** 的 [以使用者身分傳送郵件] 權限。若要建立註冊,請參閱[向 Azure AD 手動註冊您的應用程式以便存取 Office 365 API](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually) 中的**在 Azure 管理入口網站中註冊您的原生應用程式**以及範例 wiki 中的[授與適當的權限](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect/wiki/Grant-permissions-to-the-Connect-application-in-Azure),將適當的權限套用至應用程式。 19 | 20 | 21 | 22 | ## 在 Xcode 中執行這個範例 23 | 24 | 1. 複製此儲存機制 25 | 2. 使用 CocoaPods 來匯入 Active Directory Authentication Library (ADAL) iOS 相依性: 26 | 27 | pod 'ADALiOS', '= 1.2.4' 28 | 29 | 此範例應用程式已經包含可將 ADAL 元件 (pods) 放入專案的 podfile。只需從 **Terminal** 瀏覽至專案並執行: 30 | 31 | pod install 32 | 33 | 如需詳細資訊,請參閱[其他資訊](#AdditionalResources)中的**使用 CocoaPods** 34 | 35 | 3. 開啟 **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 36 | 4. 開啟 **AuthenticationConstants.swift**。您會發現 **ClientID** 和 **RedirectUri** 值可以新增至檔案的頂端。在此提供必要的值: 37 | 38 | // You will set your application's clientId and redirect URI. 39 | static let ClientId = "ENTER_YOUR_CLIENT_ID" 40 | static let RedirectUri = NSURL.init(string: "ENTER_YOUR_REDIRECT_URI") 41 | static let Authority = "https://login.microsoftonline.com/common" 42 | static let ResourceId = "https://graph.microsoft.com" 43 | 44 | > 附註:如果您沒有 CLIENT_ID 和 REDIRECT_URI 值,請[在 Azure 中新增原生用戶端應用程式](https://msdn.microsoft.com/library/azure/dn132599.aspx#BKMK_Adding)並記下 CLIENT\_ID 和 REDIRECT_URI。 45 | 46 | 5. 執行範例。 47 | 48 | 49 | ## 問題與意見 50 | 51 | 我們很樂於收到您對於 Office 365 iOS Microsoft Graph Connect Swift 專案的意見反應。您可以在此儲存機制的[問題](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect-Swift/issues)區段中,將您的問題及建議傳送給我們。 52 | 53 | 請在 [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API) 提出有關 Office 365 開發的一般問題。務必以 [Office365] 和 [MicrosoftGraph] 標記您的問題或意見。 54 | 55 | 56 | ## 其他資源 57 | 58 | * [Office 開發中心](http://dev.office.com/) 59 | * [O365-iOS-Microsoft-Graph-Connect-Obj-C](https://github.com/OfficeDev/O365-iOS-Microsoft-Graph-Connect) 60 | * [Microsoft Graph 概觀頁面](https://graph.microsoft.io) 61 | * [使用 CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 62 | 63 | ## 著作權 64 | Copyright (c) 2016 Microsoft.著作權所有,並保留一切權利。 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Microsoft Office 365 Connect Sample for iOS Using Microsoft Graph (Swift) 2 | 3 | Connecting to Microsoft Office 365 is the first step every iOS app must take to start working with Office 365 services and data. This sample shows how to connect and then call one API through Microsoft Graph. 4 | 5 | > **Note:** For the Objective-C version of this sample, see [O365-iOS-Microsoft-Graph-Connect](https://github.com/microsoftgraph/ios-objectivec-connect-rest-sample). 6 | 7 | ## Prerequisites 8 | 9 | - [Xcode](https://developer.apple.com/xcode/downloads/) version 10.2.1 10 | - [CocoaPods](https://cocoapods.org) 11 | - An Office 365 account. 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. 12 | 13 | ## Connect sample features 14 | 15 | This sample demonstrates several REST calls to the Microsoft Graph REST endpoint. 16 | 17 | - [GETs the signed in user's profile photo](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/profilephoto_get) from the *user* endpoint. 18 | - PUT request to [upload the profile photo to the user's OneDrive root folder](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_put_content) 19 | - POST a request to OneDrive to [create a sharing link for a drive item](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createlink) to give other user's access to the uploaded photo 20 | - POSTS a request to [send a mail message](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_sendmail) with a photo attachment 21 | 22 | ## Register and configure the app 23 | 24 | 1. Open a browser and navigate to the [Azure Active Directory admin center](https://aad.portal.azure.com) and login using a **personal account** (aka: Microsoft Account) or **Work or School Account**. 25 | 26 | 1. Select **Azure Active Directory** in the left-hand navigation, then select **App registrations** under **Manage**. 27 | 28 | 1. Select **New registration**. On the **Register an application** page, set the values as follows. 29 | 30 | - Set **Name** to `Swift REST Connect Sample`. 31 | - Set **Supported account types** to **Accounts in any organizational directory and personal Microsoft accounts**. 32 | - Under **Redirect URI**, change the drop down to **Public client (mobile & desktop)**, and set the value to `msauth.com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST://auth`. 33 | 34 | 1. Choose **Register**. On the **Swift REST Connect Sample** page, copy the value of the **Application (client) ID** and save it, you will need it in the next step. 35 | 36 | ### Update the sample with your client id 37 | 38 | 1. Open **O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace** 39 | 40 | 1. Open **AuthenticationConstants.swift** and replace `` with the application ID you copied in the previous step. 41 | 42 | 1. Run the sample. 43 | 44 | ## Contributing 45 | 46 | If you'd like to contribute to this sample, see [CONTRIBUTING.MD](/CONTRIBUTING.md). 47 | 48 | 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. 49 | 50 | ## Questions and comments 51 | 52 | We'd love to get your feedback about the Office 365 iOS Microsoft Graph Connect Swift project. You can send your questions and suggestions to us in the [Issues](https://github.com/microsoftgraph/ios-swift-connect-rest-sample/issues) section of this repository. 53 | 54 | Questions about Microsoft Graph development in general should be posted to [Stack Overflow](http://stackoverflow.com/questions/tagged/MicrosoftGraph). Make sure that your questions or comments are tagged with [MicrosoftGraph]. 55 | 56 | ## Copyright 57 | 58 | Copyright (c) 2017 Microsoft. All rights reserved. 59 | --------------------------------------------------------------------------------