├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── linters │ ├── .htmlhintrc │ ├── .yaml-lint.yml │ └── sun_checks.xml ├── sync-repo-settings.yaml └── workflows │ ├── automation.yml │ ├── lint.yml │ └── test.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── adminSDK ├── directory │ ├── AdminSDKDirectoryQuickstart.sln │ └── AdminSDKDirectoryQuickstart │ │ ├── AdminSDKDirectoryQuickstart.cs │ │ ├── AdminSDKDirectoryQuickstart.csproj │ │ └── packages.config ├── groups-settings │ ├── AdminSDKGroupsSettingsQuickstart.sln │ └── AdminSDKGroupsSettingsQuickstart │ │ ├── AdminSDKGroupsSettingsQuickstart.cs │ │ ├── AdminSDKGroupsSettingsQuickstart.csproj │ │ └── packages.config ├── reports │ ├── AdminSDKReportsQuickstart.sln │ └── AdminSDKReportsQuickstart │ │ ├── AdminSDKReportsQuickstart.cs │ │ ├── AdminSDKReportsQuickstart.csproj │ │ └── packages.config └── reseller │ ├── AdminSDKResellerQuickstart.sln │ └── AdminSDKResellerQuickstart │ ├── AdminSDKResellerQuickstart.cs │ ├── AdminSDKResellerQuickstart.csproj │ └── packages.config ├── appsScript ├── AppsScriptApiExecute.sln └── AppsScriptApiExecute │ ├── AppsScriptApiExecute.csproj │ └── Execute.cs ├── calendar ├── CalendarQuickstart.sln └── CalendarQuickstart │ ├── CalendarQuickstart.cs │ ├── CalendarQuickstart.csproj │ └── packages.config ├── classroom ├── ClassroomQuickstart.sln ├── ClassroomQuickstart │ ├── ClassroomQuickstart.cs │ ├── ClassroomQuickstart.csproj │ └── packages.config └── snippets │ ├── ClassroomSnippets.sln │ ├── ClassroomSnippets │ ├── AddStudent.cs │ ├── AddTeacher.cs │ ├── BatchAddStudents.cs │ ├── ClassroomSnippets.csproj │ ├── CreateCourse.cs │ ├── GetCourse.cs │ ├── ListCourseAliases.cs │ ├── ListCourses.cs │ ├── PatchCourse.cs │ └── UpdateCourse.cs │ └── ClassroomSnippetsTest │ ├── AddStudentTest.cs │ ├── AddTeacherTest.cs │ ├── BaseTest.cs │ ├── BatchAddStudentsTest.cs │ ├── ClassroomSnippetsTest.csproj │ ├── CreateCourseTest.cs │ ├── GetCourseTest.cs │ ├── ListCourseAliasesTest.cs │ ├── ListCourseTest.cs │ ├── PatchCourseTest.cs │ └── UpdateCourseTest.cs ├── docs ├── DocsQuickstart.sln └── DocsQuickstart │ ├── DocsQuickstart.cs │ ├── DocsQuickstart.csproj │ └── packages.config ├── drive ├── DriveQuickstart.sln ├── DriveQuickstart │ ├── DriveQuickstart.cs │ ├── DriveQuickstart.csproj │ └── packages.config ├── activity-v2 │ ├── DriveActivityQuickstart.sln │ └── DriveActivityQuickstart │ │ ├── DriveActivityQuickstart.cs │ │ └── DriveActivityQuickstart.csproj └── snippets │ ├── drive_v2 │ ├── DriveV2Snippets.sln │ ├── DriveV2Snippets │ │ ├── CreateDrive.cs │ │ ├── CreateFolder.cs │ │ ├── CreateShortcut.cs │ │ ├── CreateTeamDrive.cs │ │ ├── DownloadFile.cs │ │ ├── DriveV2Snippets.csproj │ │ ├── ExportPDF.cs │ │ ├── FetchAppDataFolder.cs │ │ ├── FetchChanges.cs │ │ ├── FetchStartPageToken.cs │ │ ├── ListAppData.cs │ │ ├── MoveFileToFolder.cs │ │ ├── RecoverDrives.cs │ │ ├── RecoverTeamDrives.cs │ │ ├── SearchFile.cs │ │ ├── ShareFiles.cs │ │ ├── TouchFile.cs │ │ ├── UploadAppData.cs │ │ ├── UploadBasic.cs │ │ ├── UploadToFolder.cs │ │ └── UploadWithConversion.cs │ └── DriveV2SnippetsTest │ │ ├── BaseTest.cs │ │ ├── CreateDriveTest.cs │ │ ├── CreateFolderTest.cs │ │ ├── CreateShortcutTest.cs │ │ ├── CreateTeamDriveTest.cs │ │ ├── DownloadFileTest.cs │ │ ├── DriveV2SnippetsTest.csproj │ │ ├── ExportPDFTest.cs │ │ ├── FetchAppDataFolderTest.cs │ │ ├── FetchChangesTest.cs │ │ ├── FetchStartPageTokenTest.cs │ │ ├── ListAppDataTest.cs │ │ ├── MoveFileToFolderTest.cs │ │ ├── RecoverDrivesTest.cs │ │ ├── RecoverTeamDrivesTest.cs │ │ ├── SearchFileTest.cs │ │ ├── ShareFilesTest.cs │ │ ├── TouchFileTest.cs │ │ ├── UploadAppDataTest.cs │ │ ├── UploadBasicTest.cs │ │ ├── UploadToFolderTest.cs │ │ └── UploadWithConversionTest.cs │ └── drive_v3 │ ├── DriveV3Snippets.sln │ ├── DriveV3Snippets │ ├── CreateDrive.cs │ ├── CreateFolder.cs │ ├── CreateShortcut.cs │ ├── CreateTeamDrive.cs │ ├── DownloadFile.cs │ ├── DriveV3Snippets.csproj │ ├── ExportPdf.cs │ ├── FetchAppDataFolder.cs │ ├── FetchChanges.cs │ ├── FetchStartPageToken.cs │ ├── ListAppData.cs │ ├── MoveFileToFolder.cs │ ├── RecoverDrives.cs │ ├── RecoverTeamDrives.cs │ ├── SearchFiles.cs │ ├── ShareFile.cs │ ├── TouchFile.cs │ ├── UploadAppData.cs │ ├── UploadBasic.cs │ ├── UploadToFolder.cs │ └── UploadWithConversion.cs │ └── DriveV3SnippetsTest │ ├── BaseTest.cs │ ├── CreateDriveTest.cs │ ├── CreateFolderTest.cs │ ├── CreateShortcutTest.cs │ ├── CreateTeamDriveTest.cs │ ├── DownloadFileTest.cs │ ├── DriveV3SnippetsTest.csproj │ ├── ExportPdfTest.cs │ ├── FetchAppDataFolderTest.cs │ ├── FetchChangesTest.cs │ ├── FetchStartPageTokenTest.cs │ ├── ListAppDataTest.cs │ ├── MoveFileToFolderTest.cs │ ├── RecoverDrivesTest.cs │ ├── RecoverTeamDriveTest.cs │ ├── SearchFilesTest.cs │ ├── ShareFileTest.cs │ ├── TouchFileTest.cs │ ├── UploadAppDataTest.cs │ ├── UploadBasicTest.cs │ ├── UploadToFolderTest.cs │ └── UploadWithConversionTest.cs ├── gmail ├── GmailQuickstart.sln └── GmailQuickstart │ ├── GmailQuickstart.cs │ ├── GmailQuickstart.csproj │ └── packages.config ├── renovate.json ├── sheets ├── SheetsQuickstart.sln └── SheetsQuickstart │ ├── SheetsQuickstart.cs │ ├── SheetsQuickstart.csproj │ └── packages.config ├── slides ├── SlidesQuickstart.sln └── SlidesQuickstart │ ├── SlidesQuickstart.cs │ └── SlidesQuickstart.csproj ├── tasks ├── TasksQuickstart.sln └── TasksQuickstart │ ├── TasksQuickstart.cs │ ├── TasksQuickstart.csproj │ └── packages.config └── vault ├── VaultQuickstart.sln └── VaultQuickstart ├── VaultQuickstart.cs ├── VaultQuickstart.csproj └── packages.config /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 16 | 17 | .github/ @googleworkspace/workspace-devrel-dpe 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | (Please search [existing issues](https://github.com/googleworkspace/dotnet-samples/issues) before creating a new one.) 2 | 3 | **Sample Name:** 4 | 5 | ## Expected Behavior 6 | 7 | 8 | ## Actual Behavior 9 | 10 | 11 | ## Steps to Reproduce the Problem 12 | 13 | 1. 14 | 1. 15 | 1. 16 | 17 | ## Specifications 18 | 19 | - .NET version: 20 | - OS (Mac/Linux/Windows): 21 | -------------------------------------------------------------------------------- /.github/linters/.htmlhintrc: -------------------------------------------------------------------------------- 1 | { 2 | "tagname-lowercase": true, 3 | "attr-lowercase": true, 4 | "attr-value-double-quotes": true, 5 | "attr-value-not-empty": false, 6 | "attr-no-duplication": true, 7 | "doctype-first": false, 8 | "tag-pair": true, 9 | "tag-self-close": false, 10 | "spec-char-escape": false, 11 | "id-unique": true, 12 | "src-not-empty": true, 13 | "title-require": false, 14 | "alt-require": true, 15 | "doctype-html5": true, 16 | "id-class-value": false, 17 | "style-disabled": false, 18 | "inline-style-disabled": false, 19 | "inline-script-disabled": false, 20 | "space-tab-mixed-disabled": "space", 21 | "id-class-ad-disabled": false, 22 | "href-abs-or-rel": false, 23 | "attr-unsafe-chars": true, 24 | "head-script-disabled": false 25 | } 26 | -------------------------------------------------------------------------------- /.github/linters/.yaml-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################################### 3 | # These are the rules used for # 4 | # linting all the yaml files in the stack # 5 | # NOTE: # 6 | # You can disable line with: # 7 | # # yamllint disable-line # 8 | ########################################### 9 | rules: 10 | braces: 11 | level: warning 12 | min-spaces-inside: 0 13 | max-spaces-inside: 0 14 | min-spaces-inside-empty: 1 15 | max-spaces-inside-empty: 5 16 | brackets: 17 | level: warning 18 | min-spaces-inside: 0 19 | max-spaces-inside: 0 20 | min-spaces-inside-empty: 1 21 | max-spaces-inside-empty: 5 22 | colons: 23 | level: warning 24 | max-spaces-before: 0 25 | max-spaces-after: 1 26 | commas: 27 | level: warning 28 | max-spaces-before: 0 29 | min-spaces-after: 1 30 | max-spaces-after: 1 31 | comments: disable 32 | comments-indentation: disable 33 | document-end: disable 34 | document-start: 35 | level: warning 36 | present: true 37 | empty-lines: 38 | level: warning 39 | max: 2 40 | max-start: 0 41 | max-end: 0 42 | hyphens: 43 | level: warning 44 | max-spaces-after: 1 45 | indentation: 46 | level: warning 47 | spaces: consistent 48 | indent-sequences: true 49 | check-multi-line-strings: false 50 | key-duplicates: enable 51 | line-length: 52 | level: warning 53 | max: 120 54 | allow-non-breakable-words: true 55 | allow-non-breakable-inline-mappings: true 56 | new-line-at-end-of-file: disable 57 | new-lines: 58 | type: unix 59 | trailing-spaces: disable -------------------------------------------------------------------------------- /.github/sync-repo-settings.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # .github/sync-repo-settings.yaml 16 | # See https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings for app options. 17 | rebaseMergeAllowed: true 18 | squashMergeAllowed: true 19 | mergeCommitAllowed: false 20 | deleteBranchOnMerge: true 21 | branchProtectionRules: 22 | - pattern: main 23 | isAdminEnforced: false 24 | requiresStrictStatusChecks: false 25 | requiredStatusCheckContexts: 26 | # .github/workflows/test.yml with a job called "test" 27 | - "test" 28 | # .github/workflows/lint.yml with a job called "lint" 29 | - "lint" 30 | # Google bots below 31 | - "cla/google" 32 | - "snippet-bot check" 33 | - "header-check" 34 | - "conventionalcommits.org" 35 | requiredApprovingReviewCount: 1 36 | requiresCodeOwnerReviews: true 37 | permissionRules: 38 | - team: workspace-devrel-dpe 39 | permission: admin 40 | - team: workspace-devrel 41 | permission: push 42 | -------------------------------------------------------------------------------- /.github/workflows/automation.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | name: Automation 16 | on: [ push, pull_request, workflow_dispatch ] 17 | jobs: 18 | dependabot: 19 | runs-on: ubuntu-latest 20 | if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} 21 | env: 22 | PR_URL: ${{github.event.pull_request.html_url}} 23 | GITHUB_TOKEN: ${{secrets.GOOGLEWORKSPACE_BOT_TOKEN}} 24 | steps: 25 | - name: approve 26 | run: gh pr review --approve "$PR_URL" 27 | - name: merge 28 | run: gh pr merge --auto --squash --delete-branch "$PR_URL" 29 | default-branch-migration: 30 | # this job helps with migrating the default branch to main 31 | # it pushes main to master if master exists and main is the default branch 32 | # it pushes master to main if master is the default branch 33 | runs-on: ubuntu-latest 34 | if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }} 35 | steps: 36 | - uses: actions/checkout@v2 37 | with: 38 | fetch-depth: 0 39 | # required otherwise GitHub blocks infinite loops in pushes originating in an action 40 | token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }} 41 | - name: Set env 42 | run: | 43 | # set DEFAULT BRANCH 44 | echo "DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')" >> "$GITHUB_ENV"; 45 | 46 | # set HAS_MASTER_BRANCH 47 | if [ -n "$(git ls-remote --heads origin master)" ]; then 48 | echo "HAS_MASTER_BRANCH=true" >> "$GITHUB_ENV" 49 | else 50 | echo "HAS_MASTER_BRANCH=false" >> "$GITHUB_ENV" 51 | fi 52 | env: 53 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 | - name: configure git 55 | run: | 56 | git config --global user.name 'googleworkspace-bot' 57 | git config --global user.email 'googleworkspace-bot@google.com' 58 | - if: ${{ env.DEFAULT_BRANCH == 'main' && env.HAS_MASTER_BRANCH == 'true' }} 59 | name: Update master branch from main 60 | run: | 61 | git checkout -B master 62 | git reset --hard origin/main 63 | git push origin master 64 | - if: ${{ env.DEFAULT_BRANCH == 'master'}} 65 | name: Update main branch from master 66 | run: | 67 | git checkout -B main 68 | git reset --hard origin/master 69 | git push origin main 70 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Lint 16 | on: [push, pull_request] 17 | jobs: 18 | lint: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - run: | 23 | echo "No lint checks"; 24 | exit 1; 25 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Test 16 | on: [push, pull_request] 17 | jobs: 18 | test: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - run: | 23 | echo "No tests"; 24 | exit 1; 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.*~ 3 | project.lock.json 4 | .DS_Store 5 | *.pyc 6 | nupkg/ 7 | 8 | # Visual Studio Code 9 | .vscode 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.userosscache 15 | *.sln.docstates 16 | 17 | # Build results 18 | [Dd]ebug/ 19 | [Dd]ebugPublic/ 20 | [Rr]elease/ 21 | [Rr]eleases/ 22 | x64/ 23 | x86/ 24 | build/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | msbuild.log 29 | msbuild.err 30 | msbuild.wrn 31 | 32 | # Visual Studio 2015 33 | .vs/ 34 | packages/ 35 | bin/ 36 | obj/ 37 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to become a contributor and submit your own code 2 | 3 | ## Contributor License Agreements 4 | 5 | We'd love to accept your sample apps and patches! Before we can take them, we 6 | have to jump a couple of legal hurdles. 7 | 8 | Please fill out either the individual or corporate Contributor License Agreement 9 | (CLA). 10 | 11 | * If you are an individual writing original source code and you're sure you 12 | own the intellectual property, then you'll need to sign an 13 | [individual CLA](https://developers.google.com/open-source/cla/individual). 14 | * If you work for a company that wants to allow you to contribute your work, 15 | then you'll need to sign a 16 | [corporate CLA](https://developers.google.com/open-source/cla/corporate). 17 | 18 | Follow either of the two links above to access the appropriate CLA and 19 | instructions for how to sign and return it. Once we receive it, we'll be able to 20 | accept your pull requests. 21 | 22 | ## Contributing A Patch 23 | 24 | 1. Submit an issue describing your proposed change to the repo in question. 25 | 1. The repo owner will respond to your issue promptly. 26 | 1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). 27 | 1. Fork the desired repo, develop and test your code changes. 28 | 1. Ensure that your code adheres to the existing style in the sample to which you are contributing. 29 | 1. Ensure that your code has an appropriate set of unit tests which all pass. 30 | 1. Submit a pull request! 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | .NET samples for [Google Workspace APIs](https://developers.google.com/gsuite/) docs. 2 | 3 | ## APIs 4 | 5 | - [Classroom Quickstart](https://developers.google.com/classroom/quickstart/dotnet) 6 | - [Calendar Quickstart](https://developers.google.com/calendar/api/quickstart/dotnet) 7 | - [Drive V3 Quickstart](https://developers.google.com/drive/api/quickstart/dotnet) 8 | - [Gmail Quickstart](https://developers.google.com/gmail/api/quickstart/dotnet) 9 | - [Sheets Quickstart](https://developers.google.com/sheets/api/quickstart/dotnet) 10 | - [Slides Quickstart](https://developers.google.com/slides/quickstart/dotnet) 11 | - [Tasks Quickstart](https://developers.google.com/tasks/quickstart/dotnet) 12 | - [Vault Quickstart](https://developers.google.com/vault/quickstart/dotnet) 13 | 14 | ## Setting up Visual Studio for a Command Line Project 15 | 16 | - File > New Project 17 | - Console Project 18 | - Project > Add NuGet Packages... 19 | - Search for the Google API package 20 | 21 | ## .NET Client Library 22 | 23 | Google Workspace APIs use the [Google API .NET client library](https://github.com/google/google-api-dotnet-client). 24 | 25 | ## Contributing 26 | 27 | Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md). 28 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Report a security issue 2 | 3 | To report a security issue, please use [https://g.co/vulnz](https://g.co/vulnz). We use 4 | [https://g.co/vulnz](https://g.co/vulnz) for our intake, and do coordination and disclosure here on 5 | GitHub (including using GitHub Security Advisory). The Google Security Team will 6 | respond within 5 working days of your report on [https://g.co/vulnz](https://g.co/vulnz). 7 | -------------------------------------------------------------------------------- /adminSDK/directory/AdminSDKDirectoryQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdminSDKDirectoryQuickstart", "AdminSDKDirectoryQuickstart\AdminSDKDirectoryQuickstart.csproj", "{A0E0373A-7A07-478E-AB2E-273EB47DF2E8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x64.Build.0 = Debug|Any CPU 25 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x86.Build.0 = Debug|Any CPU 27 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x64.ActiveCfg = Release|Any CPU 30 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x64.Build.0 = Release|Any CPU 31 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x86.ActiveCfg = Release|Any CPU 32 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /adminSDK/directory/AdminSDKDirectoryQuickstart/AdminSDKDirectoryQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /adminSDK/directory/AdminSDKDirectoryQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /adminSDK/groups-settings/AdminSDKGroupsSettingsQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdminSDKGroupsSettingsQuickstart", "AdminSDKGroupsSettingsQuickstart\AdminSDKGroupsSettingsQuickstart.csproj", "{A0E0373A-7A07-478E-AB2E-273EB47DF2E8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x64.Build.0 = Debug|Any CPU 25 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Debug|x86.Build.0 = Debug|Any CPU 27 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x64.ActiveCfg = Release|Any CPU 30 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x64.Build.0 = Release|Any CPU 31 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x86.ActiveCfg = Release|Any CPU 32 | {A0E0373A-7A07-478E-AB2E-273EB47DF2E8}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /adminSDK/groups-settings/AdminSDKGroupsSettingsQuickstart/AdminSDKGroupsSettingsQuickstart.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START admin_sdk_groups_settings_quickstart] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Groupssettings.v1; 18 | using Google.Apis.Services; 19 | using Google.Apis.Util.Store; 20 | using System; 21 | using System.IO; 22 | using System.Threading; 23 | using Groups = Google.Apis.Groupssettings.v1.Data.Groups; 24 | 25 | namespace AdminSDKGroupsSettingsQuickstart 26 | { 27 | class Program 28 | { 29 | // If modifying these scopes, delete your previously saved credentials 30 | // at ~/.credentials/groupssettings_v1-dotnet-quickstart.json 31 | static string[] Scopes = { "https://www.googleapis.com/auth/apps.groups.settings"}; 32 | static string ApplicationName = "Groups Settings API .NET Quickstart"; 33 | 34 | static void Main(string[] args) 35 | { 36 | UserCredential credential; 37 | 38 | using (var stream = 39 | new FileStream("credentials.json", FileMode.Open, FileAccess.Read)) 40 | { 41 | // The file token.json stores the user's access and refresh tokens, and is created 42 | // automatically when the authorization flow completes for the first time. 43 | string credPath = "token.json"; 44 | credential = GoogleWebAuthorizationBroker.AuthorizeAsync( 45 | GoogleClientSecrets.FromStream(stream).Secrets, 46 | Scopes, 47 | "user", 48 | CancellationToken.None, 49 | new FileDataStore(credPath, true)).Result; 50 | Console.WriteLine("Credential file saved to: {0}", credPath); 51 | } 52 | 53 | // Create Directory API service. 54 | var service = new GroupssettingsService(new BaseClientService.Initializer() 55 | { 56 | HttpClientInitializer = credential, 57 | ApplicationName = ApplicationName, 58 | }); 59 | 60 | // Service ready to use 61 | 62 | if (args.Length == 0) 63 | { 64 | Console.WriteLine("No group email specified."); 65 | return; 66 | } 67 | 68 | String groupEmail = args[0]; 69 | try 70 | { 71 | Groups settings = service.Groups.Get(groupEmail).Execute(); 72 | Console.Write("Description: {0}", settings.Description); 73 | } 74 | catch (Exception err) 75 | { 76 | // TODO(developer) - handle exception 77 | Console.Error.WriteLine(err); 78 | } 79 | 80 | } 81 | } 82 | } 83 | // [END admin_sdk_groups_settings_quickstart] 84 | -------------------------------------------------------------------------------- /adminSDK/groups-settings/AdminSDKGroupsSettingsQuickstart/AdminSDKGroupsSettingsQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Always 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /adminSDK/groups-settings/AdminSDKGroupsSettingsQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /adminSDK/reports/AdminSDKReportsQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdminSDKReportsQuickstart", "AdminSDKReportsQuickstart\AdminSDKReportsQuickstart.csproj", "{C2C8E393-4342-4F4A-8171-944AD0F270FC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|x64.Build.0 = Debug|Any CPU 25 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Debug|x86.Build.0 = Debug|Any CPU 27 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|x64.ActiveCfg = Release|Any CPU 30 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|x64.Build.0 = Release|Any CPU 31 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|x86.ActiveCfg = Release|Any CPU 32 | {C2C8E393-4342-4F4A-8171-944AD0F270FC}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /adminSDK/reports/AdminSDKReportsQuickstart/AdminSDKReportsQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /adminSDK/reports/AdminSDKReportsQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /adminSDK/reseller/AdminSDKResellerQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdminSDKResellerQuickstart", "AdminSDKResellerQuickstart\AdminSDKResellerQuickstart.csproj", "{15FBE443-163F-4BA2-AE05-841455AD6A58}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|x64.Build.0 = Debug|Any CPU 25 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Debug|x86.Build.0 = Debug|Any CPU 27 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|x64.ActiveCfg = Release|Any CPU 30 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|x64.Build.0 = Release|Any CPU 31 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|x86.ActiveCfg = Release|Any CPU 32 | {15FBE443-163F-4BA2-AE05-841455AD6A58}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /adminSDK/reseller/AdminSDKResellerQuickstart/AdminSDKResellerQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /adminSDK/reseller/AdminSDKResellerQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /appsScript/AppsScriptApiExecute.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsScriptApiExecute", "AppsScriptApiExecute\AppsScriptApiExecute.csproj", "{1B739466-E503-4CC9-A55D-3D6490D1BE65}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Any CPU = Debug|Any CPU 8 | Release|Any CPU = Release|Any CPU 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {1B739466-E503-4CC9-A55D-3D6490D1BE65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 12 | {1B739466-E503-4CC9-A55D-3D6490D1BE65}.Debug|Any CPU.Build.0 = Debug|Any CPU 13 | {1B739466-E503-4CC9-A55D-3D6490D1BE65}.Release|Any CPU.ActiveCfg = Release|Any CPU 14 | {1B739466-E503-4CC9-A55D-3D6490D1BE65}.Release|Any CPU.Build.0 = Release|Any CPU 15 | EndGlobalSection 16 | EndGlobal 17 | -------------------------------------------------------------------------------- /appsScript/AppsScriptApiExecute/AppsScriptApiExecute.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /calendar/CalendarQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalendarQuickstart", "CalendarQuickstart\CalendarQuickstart.csproj", "{B3772FD8-272E-4344-9733-B10ACCB80916}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|x64.Build.0 = Debug|Any CPU 25 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Debug|x86.Build.0 = Debug|Any CPU 27 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|x64.ActiveCfg = Release|Any CPU 30 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|x64.Build.0 = Release|Any CPU 31 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|x86.ActiveCfg = Release|Any CPU 32 | {B3772FD8-272E-4344-9733-B10ACCB80916}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /calendar/CalendarQuickstart/CalendarQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /calendar/CalendarQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /classroom/ClassroomQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassroomQuickstart", "ClassroomQuickstart\ClassroomQuickstart.csproj", "{5F5401AB-E202-4F30-BE4B-CFCE34971EDC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|x64.Build.0 = Debug|Any CPU 25 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Debug|x86.Build.0 = Debug|Any CPU 27 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|x64.ActiveCfg = Release|Any CPU 30 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|x64.Build.0 = Release|Any CPU 31 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|x86.ActiveCfg = Release|Any CPU 32 | {5F5401AB-E202-4F30-BE4B-CFCE34971EDC}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /classroom/ClassroomQuickstart/ClassroomQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /classroom/ClassroomQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassroomSnippets", "ClassroomSnippets\ClassroomSnippets.csproj", "{505E06C0-174B-43A0-885D-9E24E66053CC}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassroomSnippetsTest", "ClassroomSnippetsTest\ClassroomSnippetsTest.csproj", "{40AC01B1-1469-43D2-B233-8D078707CD56}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {505E06C0-174B-43A0-885D-9E24E66053CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {505E06C0-174B-43A0-885D-9E24E66053CC}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {505E06C0-174B-43A0-885D-9E24E66053CC}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {505E06C0-174B-43A0-885D-9E24E66053CC}.Release|Any CPU.Build.0 = Release|Any CPU 17 | {40AC01B1-1469-43D2-B233-8D078707CD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {40AC01B1-1469-43D2-B233-8D078707CD56}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {40AC01B1-1469-43D2-B233-8D078707CD56}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {40AC01B1-1469-43D2-B233-8D078707CD56}.Release|Any CPU.Build.0 = Release|Any CPU 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/AddStudent.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START classroom_add_student] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Classroom.v1; 18 | using Google.Apis.Classroom.v1.Data; 19 | using Google.Apis.Services; 20 | using System; 21 | using System.Net; 22 | using Google; 23 | 24 | namespace ClassroomSnippets 25 | { 26 | // Class to demonstrate the use of Classroom Create Student API 27 | public class AddStudent 28 | { 29 | public static Student ClassroomAddStudent(string courseId, string enrollmentCode) 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 37 | .CreateScoped(ClassroomService.Scope.ClassroomRosters); 38 | var service = new ClassroomService(new BaseClientService.Initializer 39 | { 40 | HttpClientInitializer = credential, 41 | ApplicationName = "Classroom API .NET Quickstart" 42 | }); 43 | 44 | var student = new Student 45 | { 46 | UserId = "me" 47 | }; 48 | 49 | var request = service.Courses.Students.Create(student, courseId); 50 | request.EnrollmentCode = enrollmentCode; 51 | student = request.Execute(); 52 | Console.WriteLine( 53 | "User '{0}' was enrolled as a student in the course with ID '{1}'.\n", 54 | student.Profile.Name.FullName, courseId); 55 | } 56 | catch (Exception e) 57 | { 58 | // TODO(developer) - handle error appropriately 59 | if (e is AggregateException) 60 | { 61 | Console.WriteLine("Credential Not found"); 62 | } 63 | else if (e is GoogleApiException) 64 | { 65 | Console.WriteLine("Failed to Add the Student. Error message: {0}", e.Message); 66 | } 67 | else 68 | { 69 | throw; 70 | } 71 | } 72 | 73 | return null; 74 | } 75 | } 76 | 77 | } 78 | // [END classroom_add_student] -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/AddTeacher.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START classroom_add_teacher] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Classroom.v1; 18 | using Google.Apis.Classroom.v1.Data; 19 | using Google.Apis.Services; 20 | using System; 21 | using System.Net; 22 | using Google; 23 | 24 | namespace ClassroomSnippets 25 | { 26 | // Class to demonstrate the use of Classroom Create Teacher API 27 | public class AddTeacher 28 | { 29 | /// 30 | /// Add teacher to the Course 31 | /// 32 | /// 33 | /// 34 | /// 35 | public static Teacher ClassroomAddTeacher( string courseId, 36 | string teacherEmail) 37 | { 38 | try 39 | { 40 | /* Load pre-authorized user credentials from the environment. 41 | TODO(developer) - See https://developers.google.com/identity for 42 | guides on implementing OAuth2 for your application. */ 43 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 44 | .CreateScoped(ClassroomService.Scope.ClassroomRosters); 45 | 46 | // Create Classroom API service. 47 | var service = new ClassroomService(new BaseClientService.Initializer 48 | { 49 | HttpClientInitializer = credential, 50 | ApplicationName = "Classroom API Snippet" 51 | }); 52 | 53 | var teacher = new Teacher 54 | { 55 | UserId = teacherEmail 56 | }; 57 | // Add the teacher to the course. 58 | teacher = service.Courses.Teachers.Create(teacher, courseId).Execute(); 59 | Console.WriteLine( 60 | "User '{0}' was added as a teacher to the course with ID '{1}'.\n", 61 | teacher.Profile.Name.FullName, courseId); 62 | return teacher; 63 | } 64 | catch (Exception e) 65 | { 66 | // TODO(developer) - handle error appropriately 67 | if (e is AggregateException) 68 | { 69 | Console.WriteLine("Credential Not found"); 70 | } 71 | else if (e is GoogleApiException) 72 | { 73 | Console.WriteLine("Failed to Add the teacher. Error message: {0}", e.Message); 74 | } 75 | else 76 | { 77 | throw; 78 | } 79 | } 80 | 81 | return null; 82 | } 83 | 84 | 85 | } 86 | 87 | } 88 | // [END classroom_add_teacher] -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/ClassroomSnippets.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | Library 6 | false 7 | UnitTest 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/GetCourse.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START classroom_get_course] 16 | using Google; 17 | using Google.Apis.Auth.OAuth2; 18 | using Google.Apis.Classroom.v1; 19 | using Google.Apis.Classroom.v1.Data; 20 | using Google.Apis.Services; 21 | using System; 22 | 23 | namespace ClassroomSnippets 24 | { 25 | // Class to demonstrate the use of Classroom Get Course API 26 | public class GetCourse 27 | { 28 | /// 29 | /// Retrieve a single course's metadata. 30 | /// 31 | /// Id of the course. 32 | /// a course, null otherwise. 33 | public static Course ClassroomGetCourse(string courseId) 34 | { 35 | try 36 | { 37 | /* Load pre-authorized user credentials from the environment. 38 | TODO(developer) - See https://developers.google.com/identity for 39 | guides on implementing OAuth2 for your application. */ 40 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 41 | .CreateScoped(ClassroomService.Scope.ClassroomCourses); 42 | 43 | // Create Classroom API service. 44 | var service = new ClassroomService(new BaseClientService.Initializer 45 | { 46 | HttpClientInitializer = credential, 47 | ApplicationName = "Classroom Snippets" 48 | }); 49 | 50 | // Get the course details using course id 51 | Course course = service.Courses.Get(courseId).Execute(); 52 | Console.WriteLine("Course '{0}' found.\n", course.Name); 53 | return course; 54 | } 55 | catch (Exception e) 56 | { 57 | // TODO(developer) - handle error appropriately 58 | if (e is AggregateException) 59 | { 60 | Console.WriteLine("Credential Not found"); 61 | } 62 | else if (e is GoogleApiException) 63 | { 64 | Console.WriteLine("Course does not exist."); 65 | } 66 | else 67 | { 68 | throw; 69 | } 70 | } 71 | return null; 72 | } 73 | } 74 | } 75 | // [END classroom_get_course] -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/PatchCourse.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START classroom_patch_course] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Classroom.v1; 18 | using Google.Apis.Classroom.v1.Data; 19 | using Google.Apis.Services; 20 | using System; 21 | using Google; 22 | 23 | namespace ClassroomSnippets 24 | { 25 | // Class to demonstrate the use of Classroom Patch Course API 26 | public class PatchUpdate 27 | { 28 | /// 29 | /// Updates one or more fields in a course. 30 | /// 31 | /// 32 | /// 33 | /// 34 | public static Course ClassroomPatchUpdate(string courseId) 35 | { 36 | try 37 | { 38 | /* Load pre-authorized user credentials from the environment. 39 | TODO(developer) - See https://developers.google.com/identity for 40 | guides on implementing OAuth2 for your application. */ 41 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 42 | .CreateScoped(ClassroomService.Scope.ClassroomCourses); 43 | 44 | // Create Classroom API service. 45 | var service = new ClassroomService(new BaseClientService.Initializer 46 | { 47 | HttpClientInitializer = credential, 48 | ApplicationName = "Classroom API Snippet" 49 | }); 50 | 51 | var course = new Course 52 | { 53 | Section = "Period 3", 54 | Room = "302" 55 | }; 56 | // Updates one or more fields of course. 57 | var request = service.Courses.Patch(course, courseId); 58 | request.UpdateMask = "section,room"; 59 | course = request.Execute(); 60 | Console.WriteLine("Course '{0}' updated.\n", course.Name); 61 | return course; 62 | } 63 | catch (Exception e) 64 | { 65 | // TODO(developer) - handle error appropriately 66 | if (e is AggregateException) 67 | { 68 | Console.WriteLine("Credential Not found"); 69 | } 70 | else if (e is GoogleApiException) 71 | { 72 | Console.WriteLine("Failed to update the course. Error message: {0}", e.Message); 73 | } 74 | else 75 | { 76 | throw ; 77 | } 78 | } 79 | 80 | return null; 81 | 82 | } 83 | } 84 | } 85 | // [END classroom_patch_course] -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippets/UpdateCourse.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START classroom_update_course] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Classroom.v1; 18 | using Google.Apis.Classroom.v1.Data; 19 | using Google.Apis.Services; 20 | using System; 21 | using System.Net; 22 | using Google; 23 | 24 | namespace ClassroomSnippets 25 | { 26 | // Class to demonstrate the use of Classroom Update Course API 27 | public class UpdateCourse 28 | { 29 | /// 30 | /// Update one field of course 31 | /// 32 | /// 33 | /// 34 | /// 35 | public static Course ClassroomUpdateCourse(string courseId) 36 | { 37 | try 38 | { 39 | /* Load pre-authorized user credentials from the environment. 40 | TODO(developer) - See https://developers.google.com/identity for 41 | guides on implementing OAuth2 for your application. */ 42 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 43 | .CreateScoped(ClassroomService.Scope.ClassroomCourses); 44 | 45 | // Create Classroom API service. 46 | var service = new ClassroomService(new BaseClientService.Initializer 47 | { 48 | HttpClientInitializer = credential, 49 | ApplicationName = "Classroom API Snippet" 50 | }); 51 | 52 | Course course = service.Courses.Get(courseId).Execute(); 53 | course.Section = "Period 3"; 54 | course.Room = "302"; 55 | course = service.Courses.Update(course, courseId).Execute(); 56 | Console.WriteLine("Course '{0}' updated.\n", course.Name); 57 | return course; 58 | } 59 | catch (Exception e) 60 | { 61 | // TODO(developer) - handle error appropriately 62 | if (e is AggregateException) 63 | { 64 | Console.WriteLine("Credential Not found"); 65 | } 66 | else if (e is GoogleApiException) 67 | { 68 | Console.WriteLine("Failed to update the course. Error message: {0}", e.Message); 69 | } 70 | else 71 | { 72 | throw; 73 | } 74 | } 75 | 76 | return null; 77 | 78 | } 79 | } 80 | 81 | } 82 | // [END classroom_update_course] -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/AddStudentTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | using NUnit.Framework; 15 | using ClassroomSnippets; 16 | 17 | namespace ClassroomSnippetsTest; 18 | 19 | public class AddStudentTest : BaseTest 20 | { 21 | [Test] 22 | public void TestAddStudent() 23 | { 24 | var course = this.CreateTestCourse(this.OtherUser); 25 | var student = AddStudent.ClassroomAddStudent(course.Id, course.EnrollmentCode); 26 | DeleteCourse(course.Id); 27 | Assert.IsNotNull(student, "Student not returned."); 28 | Assert.AreEqual(course.Id, student.CourseId, "Student added to wrong course."); 29 | } 30 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/AddTeacherTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class AddTeacherTest : BaseTest 21 | { 22 | [Test] 23 | public void TestAddTeacher() 24 | { 25 | var teacher = AddTeacher.ClassroomAddTeacher( this.TestCourse.Id, this.OtherUser); 26 | Assert.IsNotNull(teacher, "Teacher not returned."); 27 | Assert.AreEqual(this.TestCourse.Id, teacher.CourseId, "Teacher added to wrong course."); 28 | } 29 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/BaseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using Google.Apis.Classroom.v1; 16 | using Google.Apis.Classroom.v1.Data; 17 | using Google.Apis.Auth.OAuth2; 18 | using Google.Apis.Services; 19 | using NUnit.Framework; 20 | 21 | namespace ClassroomSnippetsTest; 22 | 23 | public class BaseTest 24 | { 25 | protected ClassroomService Service; 26 | protected Course TestCourse; 27 | protected string OtherUser = "gduser1@workspacesamples.dev"; 28 | 29 | [SetUp] 30 | public void SetUp() 31 | { 32 | this.Service = getService(); 33 | this.TestCourse = CreateTestCourse("me"); 34 | 35 | } 36 | 37 | protected ClassroomService getService() 38 | { 39 | 40 | /* Load pre-authorized user credentials from the environment. 41 | TODO(developer) - See https://developers.google.com/identity for 42 | guides on implementing OAuth2 for your application. */ 43 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 44 | .CreateScoped(ClassroomService.Scope.ClassroomRosters, 45 | ClassroomService.Scope.ClassroomCourses); 46 | 47 | return new ClassroomService(new BaseClientService.Initializer() 48 | { 49 | HttpClientInitializer = credential, 50 | ApplicationName = "Classroom API .NET Snippet Tests", 51 | }); 52 | } 53 | public Course CreateTestCourse(string ownerId) 54 | { 55 | string alias = "p:" + System.Guid.NewGuid().ToString(); 56 | Course course = new Course() 57 | { 58 | Id = alias, 59 | Name = "Test Course", 60 | Section = "Section", 61 | OwnerId = ownerId 62 | }; 63 | return this.Service.Courses.Create(course).Execute(); 64 | } 65 | protected void DeleteCourse(string courseId) 66 | { 67 | this.Service.Courses.Delete(courseId).Execute(); 68 | } 69 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/BatchAddStudentsTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using NUnit.Framework; 17 | using ClassroomSnippets; 18 | 19 | namespace ClassroomSnippetsTest; 20 | 21 | public class BatchAddStudentsTest : BaseTest 22 | { 23 | [Test] 24 | public void TestBatchAddStudents() 25 | { 26 | var studentEmails = new List() 27 | { 28 | "erics@homeroomacademy.com", 29 | "zach@homeroomacademy.com" 30 | }; 31 | BatchAddStudents.ClassroomBatchAddStudents(this.TestCourse.Id, studentEmails); 32 | } 33 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/ClassroomSnippetsTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | Library 6 | false 7 | UnitTest 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/CreateCourseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class CreateCourseTest : BaseTest 21 | { 22 | [Test] 23 | public void TestCreateCourse() 24 | { 25 | var course = CreateCourse.ClassroomCreateCourse(); 26 | Assert.IsNotNull(course, "Course not returned."); 27 | //DeleteCourse(course.Id); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/GetCourseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class GetCourseTest : BaseTest 21 | { 22 | [Test] 23 | public void TestGetCourse() 24 | { 25 | var course = GetCourse.ClassroomGetCourse(this.TestCourse.Id); 26 | Assert.IsNotNull(course, "Course not returned."); 27 | Assert.AreEqual(this.TestCourse.Id, course.Id, "Wrong course returned."); 28 | } 29 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/ListCourseAliasesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class ListCourseAliasesTest : BaseTest 21 | { 22 | [Test] 23 | public void TestListAliasesCourse() 24 | { 25 | var courseAliases = ListCourseAliases.ClassroomListAliases(this.TestCourse.Id); 26 | Assert.AreEqual(courseAliases.Count, 1, "Incorrect number of course aliases returned."); 27 | } 28 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/ListCourseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class ListCourseTest : BaseTest 21 | { 22 | [Test] 23 | public void TestListCourse() 24 | { 25 | var courses = ListCourses.ClassroomListCourses(); 26 | Assert.IsTrue(courses.Count > 0, "No courses returned."); 27 | } 28 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/PatchCourseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class PatchCourseTest : BaseTest 21 | { 22 | [Test] 23 | public void TestPatchCourse() 24 | { 25 | var course = PatchUpdate.ClassroomPatchUpdate(this.TestCourse.Id); 26 | Assert.IsNotNull(course, "Course not returned."); 27 | Assert.AreEqual(this.TestCourse.Id, course.Id, "Wrong course returned."); 28 | } 29 | } -------------------------------------------------------------------------------- /classroom/snippets/ClassroomSnippetsTest/UpdateCourseTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | using ClassroomSnippets; 17 | 18 | namespace ClassroomSnippetsTest; 19 | 20 | public class UpdateCourseTest : BaseTest 21 | { 22 | [Test] 23 | public void TestUpdateCourse() 24 | { 25 | var course = UpdateCourse.ClassroomUpdateCourse(this.TestCourse.Id); 26 | Assert.IsNotNull(course, "Course not returned."); 27 | Assert.AreEqual(this.TestCourse.Id, course.Id, "Wrong course returned."); 28 | } 29 | } -------------------------------------------------------------------------------- /docs/DocsQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocsQuickstart", "DocsQuickstart\DocsQuickstart.csproj", "{1807EF64-D0D6-4905-BCD7-28257D395671}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|x64.Build.0 = Debug|Any CPU 25 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Debug|x86.Build.0 = Debug|Any CPU 27 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|x64.ActiveCfg = Release|Any CPU 30 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|x64.Build.0 = Release|Any CPU 31 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|x86.ActiveCfg = Release|Any CPU 32 | {1807EF64-D0D6-4905-BCD7-28257D395671}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /docs/DocsQuickstart/DocsQuickstart.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START docs_quickstart] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Docs.v1; 18 | using Google.Apis.Docs.v1.Data; 19 | using Google.Apis.Services; 20 | using Google.Apis.Util.Store; 21 | using System; 22 | using System.IO; 23 | using System.Threading; 24 | 25 | namespace DocsQuickstart 26 | { 27 | // Class to demonstrate use of Docs get documents API 28 | class Program 29 | { 30 | /* Global instance of the scopes required by this quickstart. 31 | If modifying these scopes, delete your previously saved token.json/ folder. */ 32 | static string[] Scopes = { DocsService.Scope.DocumentsReadonly }; 33 | static string ApplicationName = "Google Docs API .NET Quickstart"; 34 | 35 | static void Main(string[] args) 36 | { 37 | try 38 | { 39 | UserCredential credential; 40 | // Load client secrets. 41 | using (var stream = 42 | new FileStream("credentials.json", FileMode.Open, FileAccess.Read)) 43 | { 44 | /* The file token.json stores the user's access and refresh tokens, and is created 45 | automatically when the authorization flow completes for the first time. */ 46 | string credPath = "token.json"; 47 | 48 | credential = GoogleWebAuthorizationBroker.AuthorizeAsync( 49 | GoogleClientSecrets.FromStream(stream).Secrets, 50 | Scopes, 51 | "user", 52 | CancellationToken.None, 53 | new FileDataStore(credPath, true)).Result; 54 | Console.WriteLine("Credential file saved to: " + credPath); 55 | } 56 | 57 | // Create Google Docs API service. 58 | var service = new DocsService(new BaseClientService.Initializer 59 | { 60 | HttpClientInitializer = credential, 61 | ApplicationName = ApplicationName 62 | }); 63 | 64 | // Define request parameters. 65 | String documentId = "195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE"; 66 | DocumentsResource.GetRequest request = service.Documents.Get(documentId); 67 | 68 | // Prints the title of the requested doc: 69 | // https://docs.google.com/document/d/195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE/edit 70 | Document doc = request.Execute(); 71 | Console.WriteLine("The title of the doc is: {0}", doc.Title); 72 | } 73 | catch (FileNotFoundException e) 74 | { 75 | Console.WriteLine(e.Message); 76 | } 77 | } 78 | } 79 | } 80 | // [END docs_quickstart] 81 | -------------------------------------------------------------------------------- /docs/DocsQuickstart/DocsQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/DocsQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /drive/DriveQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveQuickstart", "DriveQuickstart\DriveQuickstart.csproj", "{31351803-5F1A-4D59-B973-6377D8F8B071}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|x64.Build.0 = Debug|Any CPU 25 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Debug|x86.Build.0 = Debug|Any CPU 27 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|x64.ActiveCfg = Release|Any CPU 30 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|x64.Build.0 = Release|Any CPU 31 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|x86.ActiveCfg = Release|Any CPU 32 | {31351803-5F1A-4D59-B973-6377D8F8B071}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /drive/DriveQuickstart/DriveQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /drive/DriveQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /drive/activity-v2/DriveActivityQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveActivityQuickstart", "DriveActivityQuickstart\DriveActivityQuickstart.csproj", "{25C9A6C8-0C93-4660-90FD-2145868DDD29}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|x64.Build.0 = Debug|Any CPU 25 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Debug|x86.Build.0 = Debug|Any CPU 27 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|x64.ActiveCfg = Release|Any CPU 30 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|x64.Build.0 = Release|Any CPU 31 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|x86.ActiveCfg = Release|Any CPU 32 | {25C9A6C8-0C93-4660-90FD-2145868DDD29}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /drive/activity-v2/DriveActivityQuickstart/DriveActivityQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveV2Snippets", "DriveV2Snippets\DriveV2Snippets.csproj", "{87935833-1FE2-4D38-AA68-62318C6FAEF1}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveV2SnippetsTest", "DriveV2SnippetsTest\DriveV2SnippetsTest.csproj", "{39BA1721-ECD4-4432-9818-491F4E3D935B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {87935833-1FE2-4D38-AA68-62318C6FAEF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {87935833-1FE2-4D38-AA68-62318C6FAEF1}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {87935833-1FE2-4D38-AA68-62318C6FAEF1}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {87935833-1FE2-4D38-AA68-62318C6FAEF1}.Release|Any CPU.Build.0 = Release|Any CPU 17 | {39BA1721-ECD4-4432-9818-491F4E3D935B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {39BA1721-ECD4-4432-9818-491F4E3D935B}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {39BA1721-ECD4-4432-9818-491F4E3D935B}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {39BA1721-ECD4-4432-9818-491F4E3D935B}.Release|Any CPU.Build.0 = Release|Any CPU 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/CreateDrive.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_drive] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Drive.v2.Data; 21 | using Google.Apis.Services; 22 | 23 | 24 | namespace DriveV2Snippets 25 | { 26 | // Class to demonstrate use of Drive's create drive. 27 | public class CreateDrive 28 | { 29 | /// 30 | /// Create a drive. 31 | /// 32 | /// newly created drive Id. 33 | 34 | public static string DriveCreateDrive() 35 | { 36 | try 37 | { 38 | /* Load pre-authorized user credentials from the environment. 39 | TODO(developer) - See https://developers.google.com/identity for 40 | guides on implementing OAuth2 for your application. */ 41 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 42 | .CreateScoped(DriveService.Scope.Drive); 43 | 44 | // Create Drive API service. 45 | var service = new DriveService(new BaseClientService.Initializer 46 | { 47 | HttpClientInitializer = credential, 48 | ApplicationName = "Drive API Snippets" 49 | }); 50 | var driveMetadata = new Drive() 51 | { 52 | Name = "Project Resources" 53 | }; 54 | var requestId = Guid.NewGuid().ToString(); 55 | var request = service.Drives.Insert(driveMetadata, requestId); 56 | request.Fields = "id"; 57 | var drive = request.Execute(); 58 | Console.WriteLine("Drive ID: " + drive.Id); 59 | return drive.Id; 60 | } 61 | catch (Exception e) 62 | { 63 | // TODO(developer) - handle error appropriately 64 | if (e is AggregateException) 65 | { 66 | Console.WriteLine("Credential Not found. Error : {0}",e.Message); 67 | } 68 | else if (e is GoogleApiException) 69 | { 70 | Console.WriteLine("Failed with an Error : {0}", e.Message); 71 | } 72 | else 73 | { 74 | throw; 75 | } 76 | } 77 | return null; 78 | } 79 | 80 | } 81 | 82 | } 83 | // [END drive_create_drive] 84 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/CreateFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_folder] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Services; 21 | 22 | 23 | namespace DriveV2Snippets 24 | { 25 | public class CreateFolder 26 | { 27 | /// 28 | /// Creates a new folder 29 | /// 30 | /// 31 | 32 | public static string DriveCreateFolder() 33 | { 34 | try 35 | { 36 | /* Load pre-authorized user credentials from the environment. 37 | TODO(developer) - See https://developers.google.com/identity for 38 | guides on implementing OAuth2 for your application. */ 39 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 40 | .CreateScoped(DriveService.Scope.Drive); 41 | 42 | // Create Drive API service. 43 | var service = new DriveService(new BaseClientService.Initializer 44 | { 45 | HttpClientInitializer = credential, 46 | ApplicationName = "Drive API Snippets" 47 | }); 48 | // File metadata 49 | var fileMetadata = new Google.Apis.Drive.v2.Data.File() 50 | { 51 | Title = "Invoices", 52 | MimeType = "application/vnd.google-apps.folder" 53 | }; 54 | // Create a new folder on drive. 55 | var request = service.Files.Insert(fileMetadata); 56 | request.Fields = "id"; 57 | var file = request.Execute(); 58 | // Prints the created folder id. 59 | Console.WriteLine("Folder ID: " + file.Id); 60 | return file.Id; 61 | } 62 | catch (Exception e) 63 | { 64 | // TODO(developer) - handle error appropriately 65 | if (e is AggregateException) 66 | { 67 | Console.WriteLine("Credential Not found"); 68 | } 69 | else if (e is GoogleApiException) 70 | { 71 | Console.WriteLine("Failed to Create Folder with Error : {0}", e.Message); 72 | } 73 | else 74 | { 75 | throw; 76 | } 77 | } 78 | return null; 79 | } 80 | 81 | } 82 | 83 | } 84 | // [END drive_create_folder] 85 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/CreateShortcut.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_shortcut] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Services; 21 | 22 | namespace DriveV2Snippets 23 | { 24 | // Class to demonstrate Drive's create shortcut use-case 25 | public class CreateShortcut 26 | { 27 | /// 28 | /// Create a third party shortcut. 29 | /// 30 | /// newly created shortcut file id, null otherwise. 31 | public static string DriveCreateShortcut() 32 | { 33 | try 34 | { 35 | /* Load pre-authorized user credentials from the environment. 36 | TODO(developer) - See https://developers.google.com/identity for 37 | guides on implementing OAuth2 for your application. */ 38 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 39 | .CreateScoped(DriveService.Scope.Drive); 40 | 41 | // Create Drive API service. 42 | var service = new DriveService(new BaseClientService.Initializer 43 | { 44 | HttpClientInitializer = credential, 45 | ApplicationName = "Drive API Snippets" 46 | }); 47 | // Create Shortcut for file. 48 | var fileMetadata = new Google.Apis.Drive.v2.Data.File() 49 | { 50 | Title = "Project plan", 51 | MimeType = "application/vnd.google-apps.drive-sdk" 52 | }; 53 | var request = service.Files.Insert(fileMetadata); 54 | request.Fields = "id"; 55 | var file = request.Execute(); 56 | // Prints the shortcut file id. 57 | Console.WriteLine("File ID: " + file.Id); 58 | return file.Id; 59 | } 60 | catch (Exception e) 61 | { 62 | // TODO(developer) - handle error appropriately 63 | if (e is AggregateException) 64 | { 65 | Console.WriteLine("Credential Not found"); 66 | } 67 | else if (e is GoogleApiException) 68 | { 69 | Console.WriteLine("Failed with an error {0}",e.Message); 70 | } 71 | else 72 | { 73 | throw; 74 | } 75 | } 76 | return null; 77 | } 78 | } 79 | } 80 | // [END drive_create_shortcut] -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/CreateTeamDrive.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_team_drive] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Drive.v2.Data; 21 | using Google.Apis.Services; 22 | 23 | namespace DriveV2Snippets 24 | { 25 | // Class to demonstrate use of Drive create team drive. 26 | public class CreateTeamDrive 27 | { 28 | /// 29 | /// Create a drive for team. 30 | /// 31 | /// id of the created drive, null otherwise. 32 | public static string DriveCreateTeamDrive() 33 | { 34 | try 35 | { 36 | /* Load pre-authorized user credentials from the environment. 37 | TODO(developer) - See https://developers.google.com/identity for 38 | guides on implementing OAuth2 for your application. */ 39 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 40 | .CreateScoped(DriveService.Scope.Drive); 41 | 42 | // Create Drive API service. 43 | var service = new DriveService(new BaseClientService.Initializer 44 | { 45 | HttpClientInitializer = credential, 46 | ApplicationName = "Drive API Snippets" 47 | }); 48 | 49 | var teamDriveMetadata = new TeamDrive() 50 | { 51 | Name = "Project Resources" 52 | }; 53 | var requestId = Guid.NewGuid().ToString(); 54 | var request = service.Teamdrives.Insert(teamDriveMetadata, requestId); 55 | request.Fields = "id"; 56 | var teamDrive = request.Execute(); 57 | Console.WriteLine("Team Drive ID: " + teamDrive.Id); 58 | return teamDrive.Id; 59 | } 60 | catch (Exception e) 61 | { 62 | // TODO(developer) - handle error appropriately 63 | if (e is AggregateException) 64 | { 65 | Console.WriteLine("Credential Not found"); 66 | } 67 | else if (e is GoogleApiException) 68 | { 69 | Console.WriteLine("Failed with an error {0}", e); 70 | } 71 | else 72 | { 73 | throw; 74 | } 75 | } 76 | return null; 77 | } 78 | } 79 | } 80 | // [END drive_create_team_drive] -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/DriveV2Snippets.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | Library 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/FetchAppDataFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_fetch_appdata_folder] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Services; 21 | 22 | namespace DriveV2Snippets 23 | { 24 | // Class to demonstrate use-case of list out application data folder and prints folder Id. 25 | public class FetchAppDataFolder 26 | { 27 | /// 28 | /// List out application data folder and prints folder ID. 29 | /// 30 | /// application data folder's ID, null otherwise. 31 | public static string DriveFetchAppDataFolder() 32 | { 33 | try 34 | { 35 | /* Load pre-authorized user credentials from the environment. 36 | TODO(developer) - See https://developers.google.com/identity for 37 | guides on implementing OAuth2 for your application. */ 38 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 39 | .CreateScoped(DriveService.Scope.DriveAppdata); 40 | 41 | // Create Drive API service. 42 | var service = new DriveService(new BaseClientService.Initializer 43 | { 44 | HttpClientInitializer = credential, 45 | ApplicationName = "Drive API Snippets" 46 | }); 47 | 48 | var getRequest = service.Files.Get("appDataFolder"); 49 | getRequest.Fields = "id"; 50 | var file = getRequest.Execute(); 51 | Console.WriteLine("Folder ID: " + file.Id); 52 | return file.Id; 53 | } 54 | catch (Exception e) 55 | { 56 | // TODO(developer) - handle error appropriately 57 | if (e is AggregateException) 58 | { 59 | Console.WriteLine("Credentials Not found {0}", e.Message); 60 | } 61 | else if (e is GoogleApiException) 62 | { 63 | Console.WriteLine("Failed with an error {0}", e); 64 | } 65 | else 66 | { 67 | throw; 68 | } 69 | } 70 | return null; 71 | } 72 | } 73 | } 74 | // [END drive_fetch_appdata_folder] -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/FetchStartPageToken.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_fetch_start_page_token] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Services; 21 | 22 | 23 | namespace DriveV2Snippets 24 | { 25 | // Class to demonstrate use-case of Drive's fetch start page token 26 | public class FetchStartPageToken 27 | { 28 | /// 29 | /// Retrieve the starting page token. 30 | /// 31 | /// start page token as String, null otherwise. 32 | public static string DriveFetchStartPageToken() 33 | { 34 | try 35 | { 36 | /* Load pre-authorized user credentials from the environment. 37 | TODO(developer) - See https://developers.google.com/identity for 38 | guides on implementing OAuth2 for your application. */ 39 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 40 | .CreateScoped(DriveService.Scope.Drive); 41 | 42 | // Create Drive API service. 43 | var service = new DriveService(new BaseClientService.Initializer 44 | { 45 | HttpClientInitializer = credential, 46 | ApplicationName = "Drive API Snippets" 47 | }); 48 | 49 | var driveService = service; 50 | var response = driveService.Changes.GetStartPageToken().Execute(); 51 | // Prints the token value. 52 | Console.WriteLine("Start token: " + response.StartPageTokenValue); 53 | return response.StartPageTokenValue; 54 | 55 | 56 | } 57 | catch (Exception e) 58 | { 59 | // TODO(developer) - handle error appropriately 60 | if (e is AggregateException) 61 | { 62 | Console.WriteLine("Credential Not found"); 63 | } 64 | else if (e is GoogleApiException) 65 | { 66 | Console.WriteLine(" Failed With an Error {0}",e.Message); 67 | } 68 | else 69 | { 70 | throw; 71 | } 72 | } 73 | return null; 74 | } 75 | } 76 | } 77 | 78 | // [END drive_fetch_start_page_token] 79 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2Snippets/ListAppData.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_list_appdata] 16 | 17 | using Google; 18 | using Google.Apis.Auth.OAuth2; 19 | using Google.Apis.Drive.v2; 20 | using Google.Apis.Drive.v2.Data; 21 | using Google.Apis.Services; 22 | 23 | namespace DriveV2Snippets 24 | { 25 | // Class of demonstrate the use of Drive upload app data. 26 | public class ListAppData 27 | { 28 | /// 29 | /// List down files in the application data folder. 30 | /// 31 | /// list of 10 files, null otherwise. 32 | public static FileList DriveListAppData() 33 | { 34 | try 35 | { 36 | /* Load pre-authorized user credentials from the environment. 37 | TODO(developer) - See https://developers.google.com/identity for 38 | guides on implementing OAuth2 for your application. */ 39 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 40 | .CreateScoped(DriveService.Scope.Drive); 41 | 42 | // Create Drive API service. 43 | var service = new DriveService(new BaseClientService.Initializer 44 | { 45 | HttpClientInitializer = credential, 46 | ApplicationName = "Drive API Snippets" 47 | }); 48 | 49 | var request =service.Files.List(); 50 | request.Spaces = "appDataFolder"; 51 | request.Fields = "nextPageToken, items(id, title)"; 52 | request.MaxResults = 10; 53 | var result = request.Execute(); 54 | foreach (var file in result.Items) 55 | { 56 | Console.WriteLine($"Found file: {file.Title} ({file.Id})"); 57 | } 58 | } 59 | catch (Exception e) 60 | { 61 | // TODO(developer) - handle error appropriately 62 | if (e is AggregateException) 63 | { 64 | Console.WriteLine("Credentials Not found {0}", e.Message); 65 | } 66 | else if (e is GoogleApiException) 67 | { 68 | Console.WriteLine("Failed with an error {0}", e); 69 | } 70 | else 71 | { 72 | throw; 73 | } 74 | } 75 | return null; 76 | } 77 | } 78 | } 79 | // [END drive_list_appdata] 80 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/CreateDriveTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 create Drive snippet 21 | [TestFixture] 22 | public class CreateDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateDrive() 26 | { 27 | var id = CreateDrive.DriveCreateDrive(); 28 | Assert.IsNotNull(id); 29 | DeleteFileOnCleanup(id); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/CreateFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using NUnit.Framework; 16 | 17 | namespace DriveV2SnippetsTest 18 | { 19 | // Unit testcase for drive v2 create drive snippet 20 | [TestFixture] 21 | public class CreateFolderTest : BaseTest 22 | { 23 | [Test] 24 | public void TestCreateFolder() 25 | { 26 | var id = DriveV2Snippets.CreateFolder.DriveCreateFolder(); 27 | Assert.IsNotNull(id); 28 | DeleteFileOnCleanup(id); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/CreateShortcutTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 create shortcut snippet 21 | [TestFixture] 22 | public class CreateShortcutTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateShortcut() 26 | { 27 | var id = CreateShortcut.DriveCreateShortcut(); 28 | Assert.IsNotNull(id); 29 | DeleteFileOnCleanup(id); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/CreateTeamDriveTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 create Team drive snippet 21 | [TestFixture] 22 | public class CreateTeamDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateTeamDrive() 26 | { 27 | var id = CreateTeamDrive.DriveCreateTeamDrive(); 28 | Assert.IsNotNull(id); 29 | DeleteFileOnCleanup(id); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/DownloadFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 download file snippet 21 | [TestFixture] 22 | public class DownloadFileTest : BaseTest 23 | { 24 | // TODO(developer) - Provide Absolute path of file. 25 | private string filePath = "files/photo.jpg"; 26 | [Test] 27 | public void TestDownloadFile() 28 | { 29 | var id = CreateTestBlob(filePath); 30 | var fileStream = DownloadFile.DriveDownloadFile(id); 31 | var content = fileStream.GetBuffer(); 32 | Assert.AreNotEqual(0, content.Length); 33 | Assert.AreEqual(0xFF, content[0]); 34 | Assert.AreEqual(0XD8, content[1]); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/DriveV2SnippetsTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | Library 8 | false 9 | UnitTest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/ExportPDFTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Text; 16 | using DriveV2Snippets; 17 | using NUnit.Framework; 18 | 19 | namespace DriveV2SnippetsTest 20 | { 21 | 22 | // Unit testcase for drive v2 export pdf snippet 23 | [TestFixture] 24 | public class ExportPdfTest : BaseTest 25 | { 26 | // TODO(developer) - Provide Absolute path of file. 27 | private string filePath = "files/document.txt"; 28 | [Test] 29 | public void TestExportPdf() 30 | { 31 | var id = CreateTestDocument(filePath); 32 | var fileStream = ExportPdf.DriveExportPdf(id); 33 | var content = Encoding.UTF8.GetString(fileStream.ToArray()); 34 | Assert.AreNotEqual(0, content.Length); 35 | Assert.AreEqual("%PDF", content.Substring(0, 4)); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/FetchAppDataFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 fetch appData folder snippet 21 | public class FetchAppDataFolderTest : BaseTest 22 | { 23 | [Test] 24 | public void TestFetchAppDataFolder() 25 | { 26 | var id = FetchAppDataFolder.DriveFetchAppDataFolder(); 27 | Assert.IsNotNull(id); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/FetchChangesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 fetch changes snippet 21 | [TestFixture] 22 | public class FetchChangesTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestFetchChanges() 29 | { 30 | string startPageToken = FetchStartPageToken.DriveFetchStartPageToken(); 31 | var id = CreateTestBlob(filePath); 32 | string newStartPageToken = FetchChanges.DriveFetchChanges(startPageToken); 33 | Assert.IsNotNull(newStartPageToken); 34 | Assert.AreNotEqual(startPageToken, newStartPageToken); 35 | DeleteFileOnCleanup(id); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/FetchStartPageTokenTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | 19 | namespace DriveV2SnippetsTest 20 | { 21 | // Unit testcase for drive v2 fetch start page token snippet 22 | [TestFixture] 23 | public class FetchStartPageTokenTest : BaseTest 24 | { 25 | [Test] 26 | public void TestFetchStartPageToken() 27 | { 28 | string token = FetchStartPageToken.DriveFetchStartPageToken(); 29 | Assert.IsNotNull(token); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/ListAppDataTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 list appData snippet 21 | [TestFixture] 22 | public class ListAppDataTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/config.json"; 26 | 27 | [Test] 28 | public void TestListAppData() 29 | { 30 | var id = UploadAppData.DriveUploadAppData(filePath); 31 | DeleteFileOnCleanup(id); 32 | var files = ListAppData.DriveListAppData(); 33 | Assert.AreNotEqual(0, files.Items.Count); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/MoveFileToFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 move file to folder snippet 21 | [TestFixture] 22 | public class MoveFileToFolderTest : BaseTest 23 | { 24 | // TODO(developer) - Provide Absolute path of file. 25 | private string filePath = "files/document.txt"; 26 | [Test] 27 | public void TestMoveFileToFolder() 28 | { 29 | var fileId = CreateTestBlob(filePath); 30 | var folderId = CreateFolder.DriveCreateFolder(); 31 | IList parents = MoveFileToFolder.DriveMoveFileToFolder( 32 | fileId, folderId); 33 | Assert.IsTrue(parents.Contains(folderId)); 34 | Assert.AreEqual(1, parents.Count); 35 | DeleteFileOnCleanup(folderId); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/RecoverDrivesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 recover drives snippet 21 | [TestFixture] 22 | public class RecoverDrivesTest : BaseTest 23 | { 24 | [Test] 25 | public void TestRecoverDrives() 26 | { 27 | var id = CreateOrphanedDrive(); 28 | var results = RecoverDrives.DriveRecoverDrives("gduser1@workspacesamples.dev"); 29 | Assert.AreNotEqual(0, results.Count); 30 | this.service.Drives.Delete(id).Execute(); 31 | } 32 | 33 | private string CreateOrphanedDrive() 34 | { 35 | var driveId = CreateDrive.DriveCreateDrive(); 36 | var listRequest = this.service.Permissions.List(driveId); 37 | listRequest.SupportsAllDrives = true; 38 | var response = listRequest.Execute(); 39 | 40 | foreach (var permission in response.Items) 41 | { 42 | var deleteRequest = this.service.Permissions.Delete(driveId, permission.Id); 43 | deleteRequest.SupportsAllDrives = true; 44 | deleteRequest.Execute(); 45 | } 46 | return driveId; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/RecoverTeamDrivesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | /// Unit testcase for drive v2 recover team drive snippet 21 | [TestFixture] 22 | public class RecoverTeamDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestRecoverTeamDrives() 26 | { 27 | var id = CreateOrphanedTeamDrive(); 28 | var results = RecoverTeamDrives.DriveRecoverTeamDrives("gduser1@workspacesamples.dev"); 29 | Assert.AreNotEqual(0, results.Count); 30 | service.Teamdrives.Delete(id).Execute(); 31 | } 32 | 33 | private string CreateOrphanedTeamDrive() 34 | { 35 | var teamDriveId = CreateTeamDrive.DriveCreateTeamDrive(); 36 | var listRequest = this.service.Permissions.List(teamDriveId); 37 | listRequest.SupportsTeamDrives = true; 38 | var response = listRequest.Execute(); 39 | 40 | foreach (var permission in response.Items) 41 | { 42 | var deleteRequest = this.service.Permissions.Delete(teamDriveId, permission.Id); 43 | deleteRequest.SupportsTeamDrives = true; 44 | deleteRequest.Execute(); 45 | } 46 | return teamDriveId; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/SearchFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | 21 | // Unit testcase for drive v2 search files snippet 22 | [TestFixture] 23 | public class SearchFilesTest : BaseTest 24 | { 25 | [Test] 26 | public void TestSearchFiles() 27 | { 28 | var files = SearchFiles.DriveSearchFiles(); 29 | Assert.AreNotEqual(0, files.Count); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/ShareFilesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 share file snippet 21 | [TestFixture] 22 | public class ShareFileTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestShareFile() 29 | { 30 | String fileId = CreateTestBlob(filePath); 31 | var ids = ShareFile.DriveShareFile(fileId, 32 | "user@test.appsdevtesting.com", 33 | "test.appsdevtesting.com"); 34 | Assert.AreNotEqual(0, ids.Count); 35 | DeleteFileOnCleanup(fileId); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/TouchFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v3 touch file snippet 21 | [TestFixture] 22 | public class TouchFileTest : BaseTest 23 | { 24 | // TODO(developer) - Provide Absolute path of file. 25 | private string filePath = "files/document.txt"; 26 | [Test] 27 | public void TestTouchFile() 28 | { 29 | var id = CreateTestBlob(filePath); 30 | var now = DateTime.Now; 31 | var modifiedTime = TouchFile.DriveTouchFile(id, now); 32 | Assert.AreEqual(now.ToString(), modifiedTime.Value.ToString()); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/UploadAppDataTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 upload appData snippet 21 | [TestFixture] 22 | public class UploadAppDataTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/config.json"; 26 | 27 | [Test] 28 | public void TestUploadAppData() 29 | { 30 | var id = UploadAppData.DriveUploadAppData(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/UploadBasicTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 upload basic snippet 21 | [TestFixture] 22 | public class UploadBasicTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestUploadBasic() 29 | { 30 | var id = UploadBasic.DriveUploadBasic(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/UploadToFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest 19 | { 20 | // Unit testcase for drive v2 upload file to folder snippet 21 | [TestFixture] 22 | public class UploadToFolderTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestUploadToFolder() 29 | { 30 | var folderId = CreateFolder.DriveCreateFolder(); 31 | var id = UploadToFolder.DriveUploadToFolder(folderId,filePath); 32 | DeleteFileOnCleanup(folderId); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v2/DriveV2SnippetsTest/UploadWithConversionTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV2Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV2SnippetsTest{ 19 | 20 | // Unit testcase for drive v2 upload with conversion snippet 21 | [TestFixture] 22 | public class UploadWithConversionTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/report.csv"; 26 | 27 | [Test] 28 | public void TestUploadWithConversifon() 29 | { 30 | var id = UploadWithConversion.DriveUploadWithConversion(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveV3Snippets", "DriveV3Snippets\DriveV3Snippets.csproj", "{CADC79A2-203D-43AB-8322-4CEA3C25946E}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveV3SnippetsTest", "DriveV3SnippetsTest\DriveV3SnippetsTest.csproj", "{DBA71DCB-2607-40D8-852F-B269A7A672B6}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {CADC79A2-203D-43AB-8322-4CEA3C25946E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {CADC79A2-203D-43AB-8322-4CEA3C25946E}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {CADC79A2-203D-43AB-8322-4CEA3C25946E}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {CADC79A2-203D-43AB-8322-4CEA3C25946E}.Release|Any CPU.Build.0 = Release|Any CPU 17 | {DBA71DCB-2607-40D8-852F-B269A7A672B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {DBA71DCB-2607-40D8-852F-B269A7A672B6}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {DBA71DCB-2607-40D8-852F-B269A7A672B6}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {DBA71DCB-2607-40D8-852F-B269A7A672B6}.Release|Any CPU.Build.0 = Release|Any CPU 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/CreateDrive.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_drive] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Drive.v3.Data; 19 | using Google.Apis.Services; 20 | 21 | namespace DriveV3Snippets 22 | { 23 | // Class to demonstrate use of Drive's create drive. 24 | public class CreateDrive 25 | { 26 | /// 27 | /// Create a drive. 28 | /// 29 | /// newly created drive Id. 30 | public static string DriveCreateDrive() 31 | { 32 | try 33 | { 34 | /* Load pre-authorized user credentials from the environment. 35 | TODO(developer) - See https://developers.google.com/identity for 36 | guides on implementing OAuth2 for your application. */ 37 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 38 | .CreateScoped(DriveService.Scope.Drive); 39 | 40 | // Create Drive API service. 41 | var service = new DriveService(new BaseClientService.Initializer 42 | { 43 | HttpClientInitializer = credential, 44 | ApplicationName = "Drive API Snippets" 45 | }); 46 | 47 | var driveMetadata = new Drive() 48 | { 49 | Name = "Project Resources" 50 | }; 51 | var requestId = Guid.NewGuid().ToString(); 52 | var request = service.Drives.Create(driveMetadata, requestId); 53 | request.Fields = "id"; 54 | var drive = request.Execute(); 55 | Console.WriteLine("Drive ID: " + drive.Id); 56 | return drive.Id; 57 | } 58 | catch (Exception e) 59 | { 60 | // TODO(developer) - handle error appropriately 61 | if (e is AggregateException) 62 | { 63 | Console.WriteLine("Credential Not found"); 64 | } 65 | else 66 | { 67 | throw; 68 | } 69 | } 70 | return null; 71 | } 72 | } 73 | } 74 | // [END drive_create_drive] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/CreateFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_folder] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class to demonstrate use of Drive create folder API. 23 | public class CreateFolder 24 | { 25 | /// 26 | /// Creates a new folder. 27 | /// 28 | /// created folder id, null otherwise 29 | public static string DriveCreateFolder() 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 37 | .CreateScoped(DriveService.Scope.Drive); 38 | 39 | // Create Drive API service. 40 | var service = new DriveService(new BaseClientService.Initializer 41 | { 42 | HttpClientInitializer = credential, 43 | ApplicationName = "Drive API Snippets" 44 | }); 45 | 46 | // File metadata 47 | var fileMetadata = new Google.Apis.Drive.v3.Data.File() 48 | { 49 | Name = "Invoices", 50 | MimeType = "application/vnd.google-apps.folder" 51 | }; 52 | 53 | // Create a new folder on drive. 54 | var request = service.Files.Create(fileMetadata); 55 | request.Fields = "id"; 56 | var file = request.Execute(); 57 | // Prints the created folder id. 58 | Console.WriteLine("Folder ID: " + file.Id); 59 | return file.Id; 60 | } 61 | catch (Exception e) 62 | { 63 | // TODO(developer) - handle error appropriately 64 | if (e is AggregateException) 65 | { 66 | Console.WriteLine("Credential Not found"); 67 | } 68 | else 69 | { 70 | throw; 71 | } 72 | } 73 | return null; 74 | } 75 | } 76 | } 77 | // [END drive_create_folder] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/CreateShortcut.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_shortcut] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class to demonstrate Drive's create shortcut use-case 23 | public class CreateShortcut 24 | { 25 | /// 26 | /// Create a third party shortcut. 27 | /// 28 | /// newly created shortcut file id, null otherwise. 29 | public static string DriveCreateShortcut() 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential 37 | .GetApplicationDefault() 38 | .CreateScoped(DriveService.Scope.Drive); 39 | 40 | // Create Drive API service. 41 | var service = new DriveService(new BaseClientService.Initializer 42 | { 43 | HttpClientInitializer = credential, 44 | ApplicationName = "Drive API Snippets" 45 | }); 46 | 47 | // Create Shortcut for file. 48 | var fileMetadata = new Google.Apis.Drive.v3.Data.File() 49 | { 50 | Name = "Project plan", 51 | MimeType = "application/vnd.google-apps.drive-sdk" 52 | }; 53 | var request = service.Files.Create(fileMetadata); 54 | request.Fields = "id"; 55 | var file = request.Execute(); 56 | // Prints the shortcut file id. 57 | Console.WriteLine("File ID: " + file.Id); 58 | return file.Id; 59 | } 60 | catch (Exception e) 61 | { 62 | // TODO(developer) - handle error appropriately 63 | if (e is AggregateException) 64 | { 65 | Console.WriteLine("Credential Not found"); 66 | } 67 | else 68 | { 69 | throw; 70 | } 71 | } 72 | return null; 73 | } 74 | } 75 | } 76 | // [END drive_create_shortcut] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/CreateTeamDrive.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_create_team_drive] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Drive.v3.Data; 19 | using Google.Apis.Services; 20 | 21 | namespace DriveV3Snippets 22 | { 23 | // Class to demonstrate use of Drive create team drive. 24 | public class CreateTeamDrive 25 | { 26 | /// 27 | /// Create a drive for team. 28 | /// 29 | /// id of the created drive, null otherwise. 30 | public static string DriveCreateTeamDrive() 31 | { 32 | try 33 | { 34 | /* Load pre-authorized user credentials from the environment. 35 | TODO(developer) - See https://developers.google.com/identity for 36 | guides on implementing OAuth2 for your application. */ 37 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 38 | .CreateScoped(DriveService.Scope.Drive); 39 | 40 | // Create Drive API service. 41 | var service = new DriveService(new BaseClientService.Initializer 42 | { 43 | HttpClientInitializer = credential, 44 | ApplicationName = "Drive API Snippets" 45 | }); 46 | 47 | var teamDriveMetadata = new TeamDrive() 48 | { 49 | Name = "Project Resources" 50 | }; 51 | var requestId = Guid.NewGuid().ToString(); 52 | var request = service.Teamdrives.Create(teamDriveMetadata, requestId); 53 | request.Fields = "id"; 54 | var teamDrive = request.Execute(); 55 | Console.WriteLine("Team Drive ID: " + teamDrive.Id); 56 | 57 | return teamDrive.Id; 58 | } 59 | catch (Exception e) 60 | { 61 | // TODO(developer) - handle error appropriately 62 | if (e is AggregateException) 63 | { 64 | Console.WriteLine("Credential Not found"); 65 | } 66 | else 67 | { 68 | throw; 69 | } 70 | } 71 | return null; 72 | } 73 | } 74 | } 75 | // [END drive_create_team_drive] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/DriveV3Snippets.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | Library 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/FetchAppDataFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_fetch_appdata_folder] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class to demonstrate use-case of list out application data folder and prints folder Id. 23 | public class FetchAppDataFolder 24 | { 25 | /// 26 | /// List out application data folder and prints folder ID. 27 | /// 28 | /// application data folder's ID, null otherwise. 29 | public static string DriveFetchAppDataFolder() 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 37 | .CreateScoped(DriveService.Scope.DriveAppdata); 38 | 39 | // Create Drive API service. 40 | var service = new DriveService(new BaseClientService.Initializer 41 | { 42 | HttpClientInitializer = credential, 43 | ApplicationName = "Drive API Snippets" 44 | }); 45 | 46 | var getRequest = service.Files.Get("appDataFolder"); 47 | getRequest.Fields = "id"; 48 | var file = getRequest.Execute(); 49 | // Prints the fetched folder id. 50 | Console.WriteLine("Folder ID: " + file.Id); 51 | return file.Id; 52 | } 53 | catch (Exception e) 54 | { 55 | // TODO(developer) - handle error appropriately 56 | if (e is AggregateException) 57 | { 58 | Console.WriteLine("Credential Not found"); 59 | } 60 | else 61 | { 62 | throw; 63 | } 64 | } 65 | return null; 66 | } 67 | } 68 | } 69 | // [END drive_fetch_appdata_folder] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/FetchStartPageToken.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_fetch_start_page_token] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class to demonstrate use-case of Drive's fetch start page token 23 | public class FetchStartPageToken 24 | { 25 | /// 26 | /// Retrieve the starting page token. 27 | /// 28 | /// start page token as String, null otherwise. 29 | public static string DriveFetchStartPageToken() 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 37 | .CreateScoped(DriveService.Scope.Drive); 38 | 39 | // Create Drive API service. 40 | var service = new DriveService(new BaseClientService.Initializer 41 | { 42 | HttpClientInitializer = credential, 43 | ApplicationName = "Drive API Snippets" 44 | }); 45 | 46 | var response = service.Changes.GetStartPageToken().Execute(); 47 | // Prints the token value. 48 | Console.WriteLine("Start token: " + response.StartPageTokenValue); 49 | return response.StartPageTokenValue; 50 | } 51 | catch (Exception e) 52 | { 53 | // TODO(developer) - handle error appropriately 54 | if (e is AggregateException) 55 | { 56 | Console.WriteLine("Credential Not found"); 57 | } 58 | else 59 | { 60 | throw; 61 | } 62 | } 63 | return null; 64 | } 65 | } 66 | } 67 | // [END drive_fetch_start_page_token] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/ListAppData.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_list_appdata] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Drive.v3.Data; 19 | using Google.Apis.Services; 20 | 21 | namespace DriveV3Snippets 22 | { 23 | // Class to demonstrate use-case of Drive's list files in the application data folder. 24 | public class ListAppData 25 | { 26 | /// 27 | /// List down files in the application data folder. 28 | /// 29 | /// list of 10 files, null otherwise. 30 | public static FileList DriveListAppData() 31 | { 32 | try 33 | { 34 | /* Load pre-authorized user credentials from the environment. 35 | TODO(developer) - See https://developers.google.com/identity for 36 | guides on implementing OAuth2 for your application. */ 37 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 38 | .CreateScoped(DriveService.Scope.DriveAppdata); 39 | 40 | // Create Drive API service. 41 | var service = new DriveService(new BaseClientService.Initializer 42 | { 43 | HttpClientInitializer = credential, 44 | ApplicationName = "Drive API Snippets" 45 | }); 46 | 47 | var request = service.Files.List(); 48 | request.Spaces = "appDataFolder"; 49 | request.Fields = "nextPageToken, files(id, name)"; 50 | request.PageSize = 10; 51 | var result = request.Execute(); 52 | foreach (var file in result.Files) 53 | { 54 | // Prints the list of 10 file names. 55 | Console.WriteLine("Found file: {0} ({1})", file.Name, file.Id); 56 | } 57 | return result; 58 | } 59 | catch (Exception e) 60 | { 61 | // TODO(developer) - handle error appropriately 62 | if (e is AggregateException) 63 | { 64 | Console.WriteLine("Credential Not found"); 65 | } 66 | else 67 | { 68 | throw; 69 | } 70 | } 71 | return null; 72 | } 73 | } 74 | } 75 | // [END drive_list_appdata] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/SearchFiles.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_search_files] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class to demonstrate use-case of Drive search files. 23 | public class SearchFiles 24 | { 25 | /// 26 | /// Search for specific set of files. 27 | /// 28 | /// search result list, null otherwise. 29 | public static IList DriveSearchFiles() 30 | { 31 | try 32 | { 33 | /* Load pre-authorized user credentials from the environment. 34 | TODO(developer) - See https://developers.google.com/identity for 35 | guides on implementing OAuth2 for your application. */ 36 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 37 | .CreateScoped(DriveService.Scope.Drive); 38 | 39 | // Create Drive API service. 40 | var service = new DriveService(new BaseClientService.Initializer 41 | { 42 | HttpClientInitializer = credential, 43 | ApplicationName = "Drive API Snippets" 44 | }); 45 | var files = new List(); 46 | 47 | string pageToken = null; 48 | do 49 | { 50 | var request = service.Files.List(); 51 | request.Q = "mimeType='image/jpeg'"; 52 | request.Spaces = "drive"; 53 | request.Fields = "nextPageToken, files(id, name)"; 54 | request.PageToken = pageToken; 55 | var result = request.Execute(); 56 | foreach (var file in result.Files) 57 | { 58 | Console.WriteLine("Found file: {0} ({1})", file.Name, file.Id); 59 | } 60 | 61 | // [START_EXCLUDE silent] 62 | files.AddRange(result.Files); 63 | // [END_EXCLUDE] 64 | pageToken = result.NextPageToken; 65 | } while (pageToken != null); 66 | 67 | return files; 68 | } 69 | catch (Exception e) 70 | { 71 | // TODO(developer) - handle error appropriately 72 | if (e is AggregateException) 73 | { 74 | Console.WriteLine("Credential Not found"); 75 | } 76 | else 77 | { 78 | throw; 79 | } 80 | } 81 | return null; 82 | } 83 | } 84 | } 85 | // [END drive_search_files] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/TouchFile.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_touch_file] 16 | using Google; 17 | using Google.Apis.Auth.OAuth2; 18 | using Google.Apis.Drive.v3; 19 | using Google.Apis.Services; 20 | 21 | namespace DriveV3Snippets 22 | { 23 | // Class to demonstrate use-case of Drive touch file API 24 | public class TouchFile 25 | { 26 | /// 27 | /// Change the file's modification timestamp. 28 | /// 29 | /// Id of file to be modified. 30 | /// Timestamp in milliseconds. 31 | /// newly modified timestamp, null otherwise. 32 | public static DateTime? DriveTouchFile(string fileId, DateTime now) 33 | { 34 | try 35 | { 36 | /* Load pre-authorized user credentials from the environment. 37 | TODO(developer) - See https://developers.google.com/identity for 38 | guides on implementing OAuth2 for your application. */ 39 | GoogleCredential credential = GoogleCredential 40 | .GetApplicationDefault() 41 | .CreateScoped(DriveService.Scope.Drive); 42 | 43 | // Create Drive API service. 44 | var service = new DriveService(new BaseClientService.Initializer 45 | { 46 | HttpClientInitializer = credential, 47 | ApplicationName = "Drive API Snippets" 48 | }); 49 | 50 | var fileMetadata = new Google.Apis.Drive.v3.Data.File() 51 | { 52 | ModifiedTime = DateTime.Now 53 | }; 54 | // [START_EXCLUDE silent] 55 | fileMetadata.ModifiedTime = now; 56 | // [END_EXCLUDE] 57 | var request = service.Files.Update(fileMetadata, fileId); 58 | request.Fields = "id, modifiedTime"; 59 | var file = request.Execute(); 60 | // Prints the modified date of the file. 61 | Console.WriteLine("Modified time: " + file.ModifiedTime); 62 | return file.ModifiedTime; 63 | } 64 | catch (Exception e) 65 | { 66 | // TODO(developer) - handle error appropriately 67 | if (e is AggregateException) 68 | { 69 | Console.WriteLine("Credential Not found"); 70 | } 71 | else if (e is GoogleApiException) 72 | { 73 | Console.WriteLine("File not found"); 74 | } 75 | else 76 | { 77 | throw; 78 | } 79 | } 80 | return null; 81 | } 82 | } 83 | } 84 | // [END drive_touch_file] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3Snippets/UploadAppData.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // [START drive_upload_appdata] 16 | using Google.Apis.Auth.OAuth2; 17 | using Google.Apis.Drive.v3; 18 | using Google.Apis.Services; 19 | 20 | namespace DriveV3Snippets 21 | { 22 | // Class of demonstrate the use of Drive upload app data. 23 | public class UploadAppData 24 | { 25 | /// 26 | /// Insert a file in the application data folder and prints file Id. 27 | /// 28 | /// File path to upload. 29 | /// ID's of the inserted files, null otherwise. 30 | public static string DriveUploadAppData(string filePath) 31 | { 32 | try 33 | { 34 | /* Load pre-authorized user credentials from the environment. 35 | TODO(developer) - See https://developers.google.com/identity for 36 | guides on implementing OAuth2 for your application. */ 37 | GoogleCredential credential = GoogleCredential.GetApplicationDefault() 38 | .CreateScoped(DriveService.Scope.DriveAppdata); 39 | 40 | // Create Drive API service. 41 | var service = new DriveService(new BaseClientService.Initializer 42 | { 43 | HttpClientInitializer = credential, 44 | ApplicationName = "Drive API Snippets" 45 | }); 46 | var fileMetadata = new Google.Apis.Drive.v3.Data.File() 47 | { 48 | Name = "config.json", 49 | Parents = new List() 50 | { 51 | "appDataFolder" 52 | } 53 | }; 54 | FilesResource.CreateMediaUpload request; 55 | using (var stream = new FileStream(filePath, 56 | FileMode.Open)) 57 | { 58 | request = service.Files.Create( 59 | fileMetadata, stream, "application/json"); 60 | request.Fields = "id"; 61 | request.Upload(); 62 | } 63 | 64 | var file = request.ResponseBody; 65 | // Prints the file id. 66 | Console.WriteLine("File ID: " + file.Id); 67 | return file.Id; 68 | } 69 | catch (Exception e) 70 | { 71 | // TODO(developer) - handle error appropriately 72 | if (e is AggregateException) 73 | { 74 | Console.WriteLine("Credential Not found"); 75 | } 76 | else 77 | { 78 | throw; 79 | } 80 | } 81 | return null; 82 | } 83 | } 84 | } 85 | // [END drive_upload_appdata] -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/CreateDriveTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 create drive snippet 21 | [TestFixture] 22 | public class CreateDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateDrive() 26 | { 27 | var id = CreateDrive.DriveCreateDrive(); 28 | Assert.IsNotNull(id); 29 | service.Drives.Delete(id).Execute(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/CreateFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 create folder snippet 21 | [TestFixture] 22 | public class CreateFolderTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateFolder() 26 | { 27 | var id = CreateFolder.DriveCreateFolder(); 28 | Assert.IsNotNull(id); 29 | DeleteFileOnCleanup(id); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/CreateShortcutTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 create shortcut snippet 21 | [TestFixture] 22 | public class CreateShortcutTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateShortcut() 26 | { 27 | var id = CreateShortcut.DriveCreateShortcut(); 28 | Assert.IsNotNull(id); 29 | DeleteFileOnCleanup(id); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/CreateTeamDriveTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 create team drive snippet 21 | [TestFixture] 22 | public class CreateTeamDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestCreateTeamDrive() 26 | { 27 | var id = CreateTeamDrive.DriveCreateTeamDrive(); 28 | Assert.IsNotNull(id); 29 | service.Teamdrives.Delete(id).Execute(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/DownloadFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 download file snippet 21 | [TestFixture] 22 | public class DownloadFileTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestDownloadFile() 29 | { 30 | var id = CreateTestBlob(filePath); 31 | var fileStream = DownloadFile.DriveDownloadFile(id); 32 | var content = fileStream.GetBuffer(); 33 | Assert.AreNotEqual(0, content.Length); 34 | Assert.AreEqual(0xFF, content[0]); 35 | Assert.AreEqual(0XD8, content[1]); 36 | DeleteFileOnCleanup(id); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/DriveV3SnippetsTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | Library 6 | false 7 | enable 8 | UnitTest 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/ExportPdfTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Text; 16 | using DriveV3Snippets; 17 | using NUnit.Framework; 18 | 19 | namespace DriveV3SnippetsTest 20 | { 21 | 22 | // Unit testcase for drive v3 export pdf snippet 23 | [TestFixture] 24 | public class ExportPdfTest : BaseTest 25 | { 26 | //TODO(developer) - Provide absolute path of the file 27 | private string filePath = "files/document.txt"; 28 | 29 | [Test] 30 | public void TestExportPdf() 31 | { 32 | var id = CreateTestDocument(filePath); 33 | var fileStream = ExportPdf.DriveExportPdf(id); 34 | var content = Encoding.UTF8.GetString(fileStream.ToArray()); 35 | Assert.AreNotEqual(0, content.Length); 36 | Assert.AreEqual("%PDF", content.Substring(0, 4)); 37 | DeleteFileOnCleanup(id); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/FetchAppDataFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 fetch appData folder snippet 21 | public class FetchAppDataFolderTest : BaseTest 22 | { 23 | [Test] 24 | public void TestFetchAppDataFolder() 25 | { 26 | var id = FetchAppDataFolder.DriveFetchAppDataFolder(); 27 | Assert.IsNotNull(id); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/FetchChangesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 fetch changes snippet 21 | [TestFixture] 22 | public class FetchChangesTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestFetchChanges() 29 | { 30 | string startPageToken = FetchStartPageToken.DriveFetchStartPageToken(); 31 | var id = CreateTestBlob(filePath); 32 | string newStartPageToken = FetchChanges.DriveFetchChanges(startPageToken); 33 | Assert.IsNotNull(newStartPageToken); 34 | Assert.AreNotEqual(startPageToken, newStartPageToken); 35 | DeleteFileOnCleanup(id); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/FetchStartPageTokenTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 fetch start page token snippet 21 | [TestFixture] 22 | public class FetchStartPageTokenTest : BaseTest 23 | { 24 | [Test] 25 | public void TestFetchStartPageToken() 26 | { 27 | string token = FetchStartPageToken.DriveFetchStartPageToken(); 28 | Assert.IsNotNull(token); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/ListAppDataTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 list appData snippet 21 | [TestFixture] 22 | public class ListAppDataTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/config.json"; 26 | 27 | [Test] 28 | public void TestListAppData() 29 | { 30 | var id = UploadAppData.DriveUploadAppData(filePath); 31 | DeleteFileOnCleanup(id); 32 | var files = ListAppData.DriveListAppData(); 33 | Assert.AreNotEqual(0, files.Files.Count); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/MoveFileToFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 move file to folder snippet 21 | [TestFixture] 22 | public class MoveFileToFolderTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestMoveFileToFolder() 29 | { 30 | var fileId = CreateTestBlob(filePath); 31 | var folderId = CreateFolder.DriveCreateFolder(); 32 | IList parents = MoveFileToFolder.DriveMoveFileToFolder( 33 | fileId, folderId); 34 | Assert.IsTrue(parents.Contains(folderId)); 35 | Assert.AreEqual(1, parents.Count); 36 | DeleteFileOnCleanup(folderId); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/RecoverDrivesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 recover drives snippet 21 | [TestFixture] 22 | public class RecoverDrivesTest : BaseTest 23 | { 24 | [Test] 25 | public void TestRecoverDrives() 26 | { 27 | var id = CreateOrphanedDrive(); 28 | var results = RecoverDrives.DriveRecoverDrives("gduser1@workspacesamples.dev"); 29 | Assert.AreNotEqual(0, results.Count); 30 | this.service.Drives.Delete(id).Execute(); 31 | } 32 | 33 | private string CreateOrphanedDrive() 34 | { 35 | var driveId = CreateDrive.DriveCreateDrive(); 36 | var listRequest = service.Permissions.List(driveId); 37 | listRequest.SupportsAllDrives = true; 38 | var response = listRequest.Execute(); 39 | 40 | foreach (var permission in response.Permissions) 41 | { 42 | var deleteRequest = service.Permissions.Delete(driveId, permission.Id); 43 | deleteRequest.SupportsAllDrives = true; 44 | deleteRequest.Execute(); 45 | } 46 | return driveId; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/RecoverTeamDriveTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 recover team drive snippet 21 | [TestFixture] 22 | public class RecoverTeamDriveTest : BaseTest 23 | { 24 | [Test] 25 | public void TestRecoverTeamDrives() 26 | { 27 | var id = CreateOrphanedTeamDrive(); 28 | var results = RecoverTeamDrives.DriveRecoverTeamDrives("gduser1@workspacesamples.dev"); 29 | Assert.AreNotEqual(0, results.Count); 30 | service.Teamdrives.Delete(id).Execute(); 31 | } 32 | 33 | private string CreateOrphanedTeamDrive() 34 | { 35 | var teamDriveId = CreateTeamDrive.DriveCreateTeamDrive(); 36 | var listRequest = service.Permissions.List(teamDriveId); 37 | listRequest.SupportsTeamDrives = true; 38 | var response = listRequest.Execute(); 39 | 40 | foreach (var permission in response.Permissions) 41 | { 42 | var deleteRequest = service.Permissions.Delete(teamDriveId, permission.Id); 43 | deleteRequest.SupportsTeamDrives = true; 44 | deleteRequest.Execute(); 45 | } 46 | return teamDriveId; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/SearchFilesTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | 21 | // Unit testcase for drive v3 search files snippet 22 | [TestFixture] 23 | public class SearchFilesTest : BaseTest 24 | { 25 | //TODO(developer) - Provide absolute path of the file 26 | private string filePath = "files/photo.jpg"; 27 | 28 | [Test] 29 | public void TestSearchFiles() 30 | { 31 | var id = CreateTestBlob(filePath); 32 | var files = SearchFiles.DriveSearchFiles(); 33 | Assert.AreNotEqual(0, files.Count); 34 | DeleteFileOnCleanup(id); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/ShareFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 share file snippet 21 | [TestFixture] 22 | public class ShareFileTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestShareFile() 29 | { 30 | String fileId = CreateTestBlob(filePath); 31 | var ids = ShareFile.DriveShareFile(fileId, 32 | "user@test.appsdevtesting.com", 33 | "test.appsdevtesting.com"); 34 | Assert.AreNotEqual(0, ids.Count); 35 | DeleteFileOnCleanup(fileId); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/TouchFileTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 touch file snippet 21 | [TestFixture] 22 | public class TouchFileTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestTouchFile() 29 | { 30 | var id = CreateTestBlob(filePath); 31 | var now = DateTime.Now; 32 | var modifiedTime = TouchFile.DriveTouchFile(id, now); 33 | Assert.AreEqual(now.ToString(), modifiedTime.Value.ToString()); 34 | DeleteFileOnCleanup(id); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/UploadAppDataTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 upload appData snippet 21 | [TestFixture] 22 | public class UploadAppDataTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/config.json"; 26 | 27 | [Test] 28 | public void TestUploadAppData() 29 | { 30 | var id = UploadAppData.DriveUploadAppData(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/UploadBasicTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 upload basic snippet 21 | [TestFixture] 22 | public class UploadBasicTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestUploadBasic() 29 | { 30 | var id = UploadBasic.DriveUploadBasic(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/UploadToFolderTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 upload file to folder snippet 21 | [TestFixture] 22 | public class UploadToFolderTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/photo.jpg"; 26 | 27 | [Test] 28 | public void TestUploadToFolder() 29 | { 30 | var folderId = CreateFolder.DriveCreateFolder(); 31 | var id = UploadToFolder.DriveUploadToFolder(filePath,folderId); 32 | DeleteFileOnCleanup(folderId); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /drive/snippets/drive_v3/DriveV3SnippetsTest/UploadWithConversionTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using DriveV3Snippets; 16 | using NUnit.Framework; 17 | 18 | namespace DriveV3SnippetsTest 19 | { 20 | // Unit testcase for drive v3 upload with conversion snippet 21 | [TestFixture] 22 | public class UploadWithConversionTest : BaseTest 23 | { 24 | //TODO(developer) - Provide absolute path of the file 25 | private string filePath = "files/report.csv"; 26 | 27 | [Test] 28 | public void TestUploadWithConversion() 29 | { 30 | var id = UploadWithConversion.DriveUploadWithConversion(filePath); 31 | Assert.IsNotNull(id); 32 | DeleteFileOnCleanup(id); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /gmail/GmailQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GmailQuickstart", "GmailQuickstart\GmailQuickstart.csproj", "{B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|x64.Build.0 = Debug|Any CPU 25 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Debug|x86.Build.0 = Debug|Any CPU 27 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|x64.ActiveCfg = Release|Any CPU 30 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|x64.Build.0 = Release|Any CPU 31 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|x86.ActiveCfg = Release|Any CPU 32 | {B5B2AC25-141B-42EA-9A1C-5EA848C7C0D0}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /gmail/GmailQuickstart/GmailQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /gmail/GmailQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /sheets/SheetsQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SheetsQuickstart", "SheetsQuickstart\SheetsQuickstart.csproj", "{86F28A3F-D9FD-4198-A58B-2383BAA26893}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|x64.Build.0 = Debug|Any CPU 25 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Debug|x86.Build.0 = Debug|Any CPU 27 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|x64.ActiveCfg = Release|Any CPU 30 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|x64.Build.0 = Release|Any CPU 31 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|x86.ActiveCfg = Release|Any CPU 32 | {86F28A3F-D9FD-4198-A58B-2383BAA26893}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /sheets/SheetsQuickstart/SheetsQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sheets/SheetsQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /slides/SlidesQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidesQuickstart", "SlidesQuickstart\SlidesQuickstart.csproj", "{9E491DF3-CDAB-4EC7-BA51-79B664301158}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|x64.Build.0 = Debug|Any CPU 25 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Debug|x86.Build.0 = Debug|Any CPU 27 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|x64.ActiveCfg = Release|Any CPU 30 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|x64.Build.0 = Release|Any CPU 31 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|x86.ActiveCfg = Release|Any CPU 32 | {9E491DF3-CDAB-4EC7-BA51-79B664301158}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /slides/SlidesQuickstart/SlidesQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tasks/TasksQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TasksQuickstart", "TasksQuickstart\TasksQuickstart.csproj", "{43314394-B7EC-4848-9B60-3151237C5AD0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|x64.Build.0 = Debug|Any CPU 25 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Debug|x86.Build.0 = Debug|Any CPU 27 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|x64.ActiveCfg = Release|Any CPU 30 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|x64.Build.0 = Release|Any CPU 31 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|x86.ActiveCfg = Release|Any CPU 32 | {43314394-B7EC-4848-9B60-3151237C5AD0}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /tasks/TasksQuickstart/TasksQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tasks/TasksQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /vault/VaultQuickstart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VaultQuickstart", "VaultQuickstart\VaultQuickstart.csproj", "{62B4354E-B244-4466-835E-206989FC1123}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|x64.Build.0 = Debug|Any CPU 25 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {62B4354E-B244-4466-835E-206989FC1123}.Debug|x86.Build.0 = Debug|Any CPU 27 | {62B4354E-B244-4466-835E-206989FC1123}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {62B4354E-B244-4466-835E-206989FC1123}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {62B4354E-B244-4466-835E-206989FC1123}.Release|x64.ActiveCfg = Release|Any CPU 30 | {62B4354E-B244-4466-835E-206989FC1123}.Release|x64.Build.0 = Release|Any CPU 31 | {62B4354E-B244-4466-835E-206989FC1123}.Release|x86.ActiveCfg = Release|Any CPU 32 | {62B4354E-B244-4466-835E-206989FC1123}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /vault/VaultQuickstart/VaultQuickstart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /vault/VaultQuickstart/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | --------------------------------------------------------------------------------