├── .editorconfig ├── .github ├── CODEOWNERS ├── policies │ ├── msgraph-sdk-dotnet-contrib-branch-protection │ └── resourceManagement.yml └── workflows │ ├── build.yml │ ├── codeql.yml │ └── deploy.yml ├── .gitignore ├── CONTRIBUTING.md ├── Graph.Community.sln ├── LICENSE ├── README.md ├── azure-pipelines.yml ├── docs ├── Graph-Community-NuGet.png └── ROADMAP.md ├── samples ├── AppRegPublicClient.png ├── ChangeLog.cs ├── ConsoleHostedService.cs ├── Diagnostics.cs ├── DiagnosticsILogger.cs ├── ExpiringClientSecrets.cs ├── Graph.Community.Samples.csproj ├── Graph.Community.Samples.sln ├── GraphGroupExtensions.cs ├── ImmutableIds.cs ├── InteractiveLoginAppReg.png ├── MenuService.cs ├── Program.cs ├── README.md ├── RootSite.cs ├── SharePointAPIPermissions.png ├── SharePointSearch.cs ├── SiteDesign.cs ├── SiteGroups.cs ├── SitePages.cs ├── Utilities │ ├── AzureAdSettings.cs │ ├── ConsoleHttpMessageLogger.cs │ ├── DotNetILoggerHttpMessageLogger.cs │ ├── DotNetILoggerSettings.cs │ ├── SharePointSettings.cs │ ├── StringBuilderHttpMessageLogger.cs │ └── TokenCacheHelper.cs └── appSettings.json ├── src ├── .editorconfig ├── CommunityGraphClientFactory.cs ├── CommunityGraphClientOptions.cs ├── CommunityGraphConstants.cs ├── CommunityGraphTelemetry.cs ├── Diagnostics │ ├── GraphCommunityEventSource.cs │ └── GraphCommunityEventSourceListener.cs ├── Extensions │ ├── BaseRequestBuilderExtensions.cs │ ├── BaseRequestExtensions.cs │ ├── GraphGroupExtensions.cs │ ├── GraphServiceClientExtensions.cs │ ├── RequestExtensionsConstants.cs │ └── UserRequestBuilderExtensions.cs ├── Graph.Community.csproj ├── Middleware │ ├── HttpMessageFormatter.cs │ ├── IHttpMessageLogger.cs │ ├── LoggingMessageHandler.cs │ ├── NullHttpMessageLogger.cs │ ├── Options │ │ └── SharePointServiceHandlerOption.cs │ └── SharePointServiceHandler.cs ├── Models │ ├── AppTile.cs │ ├── ChangeLog │ │ ├── Change.cs │ │ ├── ChangeItem.cs │ │ ├── ChangeList.cs │ │ ├── ChangeQuery.cs │ │ ├── ChangeSite.cs │ │ ├── ChangeToken.cs │ │ ├── ChangeType.cs │ │ ├── ChangeUser.cs │ │ └── ChangeWeb.cs │ ├── Form.cs │ ├── Group.cs │ ├── HttpMessages │ │ ├── ApplySiteDesignRequest.cs │ │ ├── ApplySiteDesignResponse.cs │ │ ├── CreateSiteDesignRequest.cs │ │ ├── GetChangesRequest.cs │ │ ├── SiteDesignRequestInfo.cs │ │ ├── SiteScriptRequestInfo.cs │ │ ├── StorageEntitiesResponse.cs │ │ ├── TenantSettingsResponse.cs │ │ ├── UpdateSiteDesignRequest.cs │ │ └── UpdateSiteScriptRequest.cs │ ├── List.cs │ ├── ListField │ │ ├── Field.cs │ │ ├── FieldChoice.cs │ │ ├── FieldDateTime.cs │ │ ├── FieldLookup.cs │ │ ├── FieldMultiChoice.cs │ │ ├── FieldMultiLineText.cs │ │ ├── FieldNumber.cs │ │ ├── FieldTaxonomy.cs │ │ ├── FieldText.cs │ │ ├── FieldUrl.cs │ │ └── FieldUser.cs │ ├── ListItem.cs │ ├── Navigation.cs │ ├── NavigationNode.cs │ ├── NavigationNodeCreationInformation.cs │ ├── Principal.cs │ ├── RegionalSettings.cs │ ├── SPPrincipalType.cs │ ├── SearchQuery.cs │ ├── SearchResult.cs │ ├── Site.cs │ ├── SiteDesignMetadata.cs │ ├── SiteDesignRun.cs │ ├── SitePage.cs │ ├── SitePageCheckoutType.cs │ ├── SitePageFileInfo.cs │ ├── SitePageModerationStatus.cs │ ├── SitePagePromotedState.cs │ ├── SitePagePublishedStatus.cs │ ├── SitePageVersion.cs │ ├── SiteScriptMetadata.cs │ ├── StorageEntity.cs │ ├── User.cs │ ├── UserInfo.cs │ └── Web.cs ├── README.md ├── Requests │ ├── AppCatalog │ │ ├── AppCatalogUrlRequest.cs │ │ ├── AppCatalogUrlRequestBuilder.cs │ │ ├── IAppCatalogUrlRequest.cs │ │ └── IAppCatalogUrlRequestBuilder.cs │ ├── AppTiles │ │ ├── AppTileCollectionPage.cs │ │ ├── AppTileCollectionRequest.cs │ │ ├── AppTileCollectionRequestBuilder.cs │ │ ├── IAppTileCollectionPage.cs │ │ ├── IAppTileCollectionRequest.cs │ │ └── IAppTileCollectionRequestBuilder.cs │ ├── BaseSharePointAPIRequest.cs │ ├── ChangeLog │ │ ├── ChangeLogCollectionPage.cs │ │ ├── ChangeLogRequest.cs │ │ └── IChangeLogCollectionPage.cs │ ├── ISharePointAPIRequestBuilder.cs │ ├── List │ │ ├── IListCollectionPage.cs │ │ ├── IListCollectionRequest.cs │ │ ├── IListCollectionRequestBuilder.cs │ │ ├── IListRequest.cs │ │ ├── IListRequestBuilder.cs │ │ ├── ListCollectionPage.cs │ │ ├── ListCollectionRequest.cs │ │ ├── ListCollectionRequestBuilder.cs │ │ ├── ListRequest.cs │ │ └── ListRequestBuilder.cs │ ├── ListField │ │ ├── IListFieldCollectionPage.cs │ │ ├── IListFieldCollectionRequest.cs │ │ ├── IListFieldCollectionRequestBuilder.cs │ │ ├── IListFieldRequest.cs │ │ ├── IListFieldRequestBuilder.cs │ │ ├── ListFieldCollectionPage.cs │ │ ├── ListFieldCollectionRequest.cs │ │ ├── ListFieldCollectionRequestBuilder.cs │ │ ├── ListFieldRequest.cs │ │ └── ListFieldRequestBuilder.cs │ ├── ListItem │ │ ├── IListItemCollectionPage.cs │ │ ├── IListItemCollectionRequest.cs │ │ ├── IListItemCollectionRequestBuilder.cs │ │ ├── IListItemRequest.cs │ │ ├── IListItemRequestBuilder.cs │ │ ├── ListItemCollectionPage.cs │ │ ├── ListItemCollectionRequest.cs │ │ ├── ListItemCollectionRequestBuilder.cs │ │ ├── ListItemRequest.cs │ │ └── ListItemRequestBuilder.cs │ ├── Navigation │ │ ├── INavigationNodeCollectionPage.cs │ │ ├── INavigationNodeCollectionRequest.cs │ │ ├── INavigationNodeCollectionRequestBuilder.cs │ │ ├── INavigationNodeRequest.cs │ │ ├── INavigationNodeRequestBuilder.cs │ │ ├── INavigationRequest.cs │ │ ├── INavigationRequestBuilder.cs │ │ ├── NavigationNodeCollectionPage.cs │ │ ├── NavigationNodeCollectionRequest.cs │ │ ├── NavigationNodeCollectionRequestBuilder.cs │ │ ├── NavigationNodeRequest.cs │ │ ├── NavigationNodeRequestBuilder.cs │ │ ├── NavigationRequest.cs │ │ └── NavigationRequestBuilder.cs │ ├── Search │ │ ├── ISearchRequest.cs │ │ ├── ISearchRequestBuilder.cs │ │ ├── SearchRequest.cs │ │ └── SearchRequestBuilder.cs │ ├── SharePointAPICollectionResponse.cs │ ├── SharePointAPIRequestBuilder.cs │ ├── SharePointAPIRequestConstants.cs │ ├── Site │ │ ├── ISiteRequest.cs │ │ ├── ISiteRequestBuilder.cs │ │ ├── SiteRequest.cs │ │ └── SiteRequestBuilder.cs │ ├── SiteDesign │ │ ├── ApplySiteDesignActionOutcomeCollectionPage.cs │ │ ├── IApplySiteDesignActionOutcomeCollectionPage.cs │ │ ├── ISiteDesignCollectionPage.cs │ │ ├── ISiteDesignCollectionRequest.cs │ │ ├── ISiteDesignCollectionRequestBuilder.cs │ │ ├── ISiteDesignRequest.cs │ │ ├── ISiteDesignRequestBuilder.cs │ │ ├── ISiteDesignRunCollectionPage.cs │ │ ├── ISiteDesignRunRequest.cs │ │ ├── ISiteDesignRunRequestBuilder.cs │ │ ├── SiteDesignCollectionPage.cs │ │ ├── SiteDesignCollectionRequest.cs │ │ ├── SiteDesignCollectionRequestBuilder.cs │ │ ├── SiteDesignRequest.cs │ │ ├── SiteDesignRequestBuilder.cs │ │ ├── SiteDesignRunCollectionPage.cs │ │ ├── SiteDesignRunRequest.cs │ │ └── SiteDesignRunRequestBuilder.cs │ ├── SiteGroups │ │ ├── ISiteGroupCollectionPage.cs │ │ ├── ISiteGroupCollectionRequest.cs │ │ ├── ISiteGroupCollectionRequestBuilder.cs │ │ ├── ISiteGroupRequest.cs │ │ ├── ISiteGroupRequestBuilder.cs │ │ ├── SiteGroupCollectionPage.cs │ │ ├── SiteGroupCollectionRequest.cs │ │ ├── SiteGroupCollectionRequestBuilder.cs │ │ ├── SiteGroupRequest.cs │ │ └── SiteGroupRequestBuilder.cs │ ├── SitePages │ │ ├── ISitePageCollectionPage.cs │ │ ├── ISitePageCollectionRequest.cs │ │ ├── ISitePageCollectionRequestBuilder.cs │ │ ├── ISitePageRequest.cs │ │ ├── ISitePageRequestBuilder.cs │ │ ├── ISitePageVersionCollectionPage.cs │ │ ├── ISitePageVersionCollectionRequest.cs │ │ ├── ISitePageVersionCollectionRequestBuilder.cs │ │ ├── SitePageCollectionPage.cs │ │ ├── SitePageCollectionRequest.cs │ │ ├── SitePageCollectionRequestBuilder.cs │ │ ├── SitePageRequest.cs │ │ ├── SitePageRequestBuilder.cs │ │ ├── SitePageVersionCollectionPage.cs │ │ ├── SitePageVersionCollectionRequest.cs │ │ └── SitePageVersionCollectionRequestBuilder.cs │ ├── SiteScript │ │ ├── ISiteScriptCollectionPage.cs │ │ ├── ISiteScriptCollectionRequest.cs │ │ ├── ISiteScriptCollectionRequestBuilder.cs │ │ ├── ISiteScriptRequest.cs │ │ ├── ISiteScriptRequestBuilder.cs │ │ ├── SiteScriptCollectionPage.cs │ │ ├── SiteScriptCollectionRequest.cs │ │ ├── SiteScriptCollectionRequestBuilder.cs │ │ ├── SiteScriptRequest.cs │ │ └── SiteScriptRequestBuilder.cs │ ├── SiteUsers │ │ ├── ISiteUserCollectionPage.cs │ │ ├── ISiteUserCollectionRequest.cs │ │ ├── ISiteUserCollectionRequestBuilder.cs │ │ ├── ISiteUserRequest.cs │ │ ├── ISiteUserRequestBuilder.cs │ │ ├── SiteUserCollectionPage.cs │ │ ├── SiteUserCollectionRequest.cs │ │ ├── SiteUserCollectionRequestBuilder.cs │ │ ├── SiteUserRequest.cs │ │ └── SiteUserRequestBuilder.cs │ ├── StorageEntity │ │ ├── IStorageEntityCollectionRequest.cs │ │ ├── IStorageEntityCollectionRequestBuilder.cs │ │ ├── IStorageEntityRequest.cs │ │ ├── IStorageEntityRequestBuilder.cs │ │ ├── StorageEntityCollectionRequest.cs │ │ ├── StorageEntityCollectionRequestBuilder.cs │ │ ├── StorageEntityRequest.cs │ │ └── StorageEntityRequestBuilder.cs │ ├── Tenant │ │ ├── ITenantRequestBuilder.cs │ │ └── TenantRequestBuilder.cs │ ├── UserMailboxSettings │ │ ├── IUserMailboxSettingsRequest.cs │ │ ├── IUserMailboxSettingsRequestBuilder.cs │ │ ├── UserMailboxSettingsRequest.cs │ │ └── UserMailboxSettingsRequestBuilder.cs │ └── Web │ │ ├── IWebRequest.cs │ │ ├── IWebRequestBuilder.cs │ │ ├── WebRequest.cs │ │ └── WebRequestBuilder.cs ├── Serializer │ ├── SPChangeQueryConverter.cs │ ├── SPDerivedTypeConverterAttribute.cs │ ├── SPDerivedTypedConverter.cs │ ├── SPEnumIntAsStringConverter.cs │ ├── SPNavigationNodeConverter.cs │ ├── SPODataTypeConverter.cs │ └── SPSearchQueryConverter.cs └── graph-community.png └── test ├── BaseRequestBuilderExtensionTests.cs ├── BaseRequestExtensionTests.cs ├── BaseSharePointAPIRequestTests.cs ├── ChangeLogRequestTests.cs ├── ChangeQuerySerializationTests.cs ├── Graph.Community.Test.csproj ├── GraphGroupExtensionsTests.cs ├── ListCollectionRequestTests.cs ├── ListFieldCollectionRequestTests.cs ├── ListItemCollectionRequestTests.cs ├── ListItemRequestTests.cs ├── ListRequestTests.cs ├── LoggingMessageHandlerTests.cs ├── Mocks ├── ApplySiteDesignResponse.json ├── CreateSiteDesignResponse.json ├── CreateSiteScriptResponse.json ├── EnsureSiteAssetsResponse.json ├── EnsureUserResponse.json ├── GetChangesResponse.json ├── GetListFieldsResponse.json ├── GetListItemResponse.json ├── GetListItemsResponse.json ├── GetListResponse.json ├── GetListsResponse.json ├── GetSiteDesignMetadataResponse.json ├── GetSiteDesignRunsResponse.json ├── GetSiteDesignsResponse.json ├── GetSiteGroupsExpandUsersResponse.json ├── GetSiteGroupsResponse.json ├── GetSitePageResponse.json ├── GetSitePageVersionsResponse.json ├── GetSitePagesResponse.json ├── GetSiteResponse.json ├── GetSiteScriptMetadataResponse.json ├── GetSiteScriptsResponse.json ├── GetSiteUserResponse.json ├── GetSiteUsersResponse.json ├── GetStorageEntitiesResponse.json ├── GetTenantAppCatalogUrlResponse.json ├── GetUserMailboxSettingsResponse.json ├── GetWebAppTilesResponse.json ├── GetWebAssociatedGroupsResponse.json ├── GetWebAssociatedGroupsWithUsersResponse.json ├── GetWebResponse.json ├── GetWebSitePagesListResponse.json ├── MockAuthenticationProvider.cs ├── MockHttpProvider.cs ├── MockSharePointServiceHandler.cs ├── NavigationNodeCollectionResponse.json ├── SearchQueryResponse.json ├── TestGraphServiceClient.cs ├── TestResponseHandler.cs ├── TestSerializer.cs ├── UpdateSiteDesignResponse.json ├── UpdateSiteScriptResponse.json └── WebAssociatedGroupResponse.json ├── ResourceManager.cs ├── SearchQueryModelTests.cs ├── SearchRequestTests.cs ├── SiteDesignCollectionRequestTests.cs ├── SiteDesignRequestTests.cs ├── SiteDesignRunRequestTests.cs ├── SitePageConverterTests.cs ├── SitePageFileInfoConverterTests.cs ├── SitePageRequestTests.cs ├── SitePagesCollectionRequestTests.cs ├── SiteRequestTests.cs ├── SiteScriptCollectionRequestTests.cs ├── SiteScriptRequestTests.cs ├── StorageEntityCollectionRequestTests.cs ├── StorageEntityRequestTests.cs ├── TenantAppCatalogUrlTests.cs ├── UserMailboxSettingsRequestTests.cs ├── WebAppTilesRequestTests.cs ├── WebNavigationRequestTests.cs ├── WebRequestTests.cs ├── WebSiteGroupsRequestTests.cs └── WebSiteUsersRequestTests.cs /.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | [*] 3 | indent_style = spaces 4 | indent_size = 2 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @microsoftgraph/msgraph-sdk-dotnet-contrib-write 2 | * @pschaeflein 3 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: 'Build' 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - graph-v4 8 | - master 9 | pull_request: 10 | branches: 11 | - graph-v4 12 | - master 13 | 14 | env: 15 | # Stop wasting time caching packages 16 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true 17 | # Disable sending usage data to Microsoft 18 | DOTNET_CLI_TELEMETRY_OPTOUT: true 19 | # Project name to pack and publish 20 | PROJECT_NAME: Graph.Community 21 | # Official NuGet Feed settings 22 | NUGET_FEED: https://api.nuget.org/v3/index.json 23 | NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} 24 | 25 | jobs: 26 | build: 27 | runs-on: windows-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v2 31 | - name: Setup .NET Core 32 | uses: actions/setup-dotnet@v1 33 | - name: Restore 34 | run: dotnet restore 35 | - name: Build 36 | run: dotnet build -c Release --no-restore 37 | - name: Test 38 | run: dotnet test -c Release 39 | 40 | 41 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy NuGet 2 | 3 | on: 4 | release: 5 | types: [ published ] 6 | 7 | env: 8 | # Stop wasting time caching packages 9 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true 10 | # Disable sending usage data to Microsoft 11 | DOTNET_CLI_TELEMETRY_OPTOUT: true 12 | # Project name to pack and publish 13 | PROJECT_NAME: Graph.Community 14 | # Official NuGet Feed settings 15 | NUGET_FEED: https://api.nuget.org/v3/index.json 16 | NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} 17 | 18 | jobs: 19 | deploy: 20 | if: github.event_name == 'release' 21 | runs-on: windows-latest 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Setup .NET Core 25 | uses: actions/setup-dotnet@v1 26 | - name: Create Release NuGet package 27 | run: | 28 | $VERSION=($env:GITHUB_REF -split "/" | select -skip 2).TrimStart("v") 29 | echo Version: $VERSION 30 | dotnet pack -v normal -c Release --include-source -p:PackageVersion=$VERSION -p:Version=$VERSION -o nupkg src/$env:PROJECT_NAME.csproj 31 | - name: Push to NuGet Feed 32 | run: dotnet nuget push **\*.nupkg --source $env:NUGET_FEED --skip-duplicate --api-key $env:NUGET_APIKEY 33 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the Graph.Community Library 2 | Thanks for considering making a contribution! Read over our guidelines and we will do our best to see your PRs merged successfully. 3 | 4 | There are a few different recommended paths to get contributions into the released version of this library. 5 | 6 | ## File issues 7 | The best way to get started with a contribution is to start a dialog with us. Sometimes features will be under development or out of scope for this library and it's best to check before starting work on contribution, especially for large work items. 8 | 9 | ## Pull requests 10 | All pull requests should be submitted against the **prerelease** branch. The master branch is intended to represent the code released in the most-recent Nuget package. 11 | 12 | When a new package is about to be released, changes in dev will be merged into master. The package will be generated from master. 13 | 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Microsoft Graph 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/Graph-Community-NuGet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-dotnet-contrib/c02dfeed814378bf49d9bbc80e8a1995a8c87ead/docs/Graph-Community-NuGet.png -------------------------------------------------------------------------------- /samples/AppRegPublicClient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-dotnet-contrib/c02dfeed814378bf49d9bbc80e8a1995a8c87ead/samples/AppRegPublicClient.png -------------------------------------------------------------------------------- /samples/Graph.Community.Samples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | 68071ad2-6ee0-41d1-ad86-2635c69bfadf 7 | Debug;Prerelease;LocalDev 8 | latest 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | PreserveNewest 35 | 36 | 37 | PreserveNewest 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /samples/InteractiveLoginAppReg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-dotnet-contrib/c02dfeed814378bf49d9bbc80e8a1995a8c87ead/samples/InteractiveLoginAppReg.png -------------------------------------------------------------------------------- /samples/SharePointAPIPermissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-dotnet-contrib/c02dfeed814378bf49d9bbc80e8a1995a8c87ead/samples/SharePointAPIPermissions.png -------------------------------------------------------------------------------- /samples/Utilities/AzureAdSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community.Samples 2 | { 3 | public class AzureAdSettings 4 | { 5 | public const string ConfigurationSectionName = "AzureAd"; 6 | public string TenantId { get; set; } 7 | public string ClientId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/Utilities/ConsoleHttpMessageLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Graph.Community.Samples 5 | { 6 | class ConsoleHttpMessageLogger : IHttpMessageLogger 7 | { 8 | public async Task WriteLine(string value) 9 | { 10 | Console.WriteLine(value); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/Utilities/DotNetILoggerHttpMessageLogger.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Microsoft.Extensions.Options; 3 | using System.Threading.Tasks; 4 | 5 | namespace Graph.Community.Samples 6 | { 7 | public class DotNetILoggerHttpMessageLogger : IHttpMessageLogger 8 | { 9 | private readonly ILogger logger; 10 | private readonly LogLevel logLevel; 11 | 12 | public DotNetILoggerHttpMessageLogger( 13 | ILogger logger, 14 | IOptions dotNetILoggerOptions) 15 | { 16 | this.logger = logger; 17 | this.logLevel = dotNetILoggerOptions?.Value?.LogLevel ?? LogLevel.Trace; 18 | } 19 | 20 | public async Task WriteLine(string message) 21 | { 22 | logger.Log(logLevel, message); 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/Utilities/DotNetILoggerSettings.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Graph.Community.Samples 7 | { 8 | public class DotNetILoggerSettings 9 | { 10 | public LogLevel LogLevel { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/Utilities/SharePointSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Graph.Community.Samples 6 | { 7 | public class SharePointSettings 8 | { 9 | public const string ConfigurationSectionName = "SharePoint"; 10 | 11 | public string Hostname { get; set; } 12 | public string SiteCollectionUrl { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/Utilities/StringBuilderHttpMessageLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Threading.Tasks; 3 | 4 | namespace Graph.Community.Samples 5 | { 6 | class StringBuilderHttpMessageLogger : IHttpMessageLogger 7 | { 8 | private readonly StringBuilder sb = new StringBuilder(); 9 | 10 | public string GetLog() 11 | { 12 | var log = sb.ToString(); 13 | sb.Clear(); 14 | return log; 15 | } 16 | 17 | public async Task WriteLine(string value) 18 | { 19 | sb.AppendLine(value); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/appSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "AzureAd": { 3 | "TenantId": "", 4 | "ClientId": "" 5 | }, 6 | "SharePoint": { 7 | "Hostname": "demo.sharepoint.com", 8 | "SiteCollectionUrl": "/sites/GraphCommunityTest" 9 | }, 10 | "Logging": { 11 | "Console": { 12 | "LogLevel": { 13 | "Microsoft.Hosting.Lifetime": "Warning" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/CommunityGraphClientOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | 3 | namespace Graph.Community 4 | { 5 | public class CommunityGraphClientOptions 6 | { 7 | /// 8 | /// Set to true to disable telemetry 9 | /// 10 | public bool DisableTelemetry { get; set; } 11 | /// 12 | /// The UserAgent to set on requests. Overridden by 13 | /// 14 | public string UserAgent { get; set; } 15 | /// 16 | /// The UserAgentInfo for decorating SharePoint traffice. Overrides 17 | /// 18 | public SharePointThrottlingDecoration UserAgentInfo { get; set; } 19 | 20 | public CommunityGraphClientOptions() { } 21 | public CommunityGraphClientOptions(string companyName, string appName, string appVersion, bool isv) 22 | { 23 | this.UserAgentInfo = new SharePointThrottlingDecoration() 24 | { 25 | CompanyName = companyName, 26 | AppName = appName, 27 | AppVersion = appVersion, 28 | ISV = isv 29 | }; 30 | } 31 | } 32 | 33 | public struct SharePointThrottlingDecoration 34 | { 35 | public string CompanyName { get; set; } 36 | public string AppName { get; set; } 37 | public string AppVersion { get; set; } 38 | public bool ISV { get; set; } 39 | 40 | public bool IsEmpty() 41 | { 42 | return string.IsNullOrEmpty(CompanyName) && 43 | string.IsNullOrEmpty(AppName) && 44 | string.IsNullOrEmpty(AppName) && 45 | !ISV; 46 | } 47 | 48 | public ProductInfoHeaderValue ToUserAgent() 49 | { 50 | var isvDecoration = ISV ? "ISV" : "NONISV"; 51 | var product = $"{isvDecoration}|{CompanyName}|{AppName}"; 52 | return new ProductInfoHeaderValue(product, AppVersion); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/CommunityGraphConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public static class CommunityGraphConstants 4 | { 5 | public static class Library 6 | { 7 | /// The key for the SDK version header. 8 | internal static readonly string VersionHeaderName = CommunityGraphConstants.Headers.CommunityLibraryVersionHeaderName; 9 | 10 | /// The version for current assembly. 11 | internal static string AssemblyVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(CommunityGraphConstants).Assembly.Location).FileVersion; 12 | 13 | /// The value for the SDK version header. 14 | internal static string VersionHeaderValue = $"dotnet-{AssemblyVersion}"; 15 | } 16 | 17 | public static class Serialization 18 | { 19 | internal const string ODataType = "odata.type"; 20 | } 21 | 22 | public static class Headers 23 | { 24 | /// Library Version header 25 | public const string CommunityLibraryVersionHeaderName = "CommunityLibraryVersion"; 26 | 27 | /// Library Version header 28 | public const string CommunityLibraryVersionHeaderValueFormatString = "dotnet-{0}.{1}.{2}"; 29 | } 30 | 31 | public static class TelemetryProperties 32 | { 33 | public const string ResourceUri = nameof(ResourceUri); 34 | public const string RequestMethod = nameof(RequestMethod); 35 | public const string ClientRequestId = nameof(ClientRequestId); 36 | public const string ResponseStatus = nameof(ResponseStatus); 37 | public const string RawErrorResponse = nameof(RawErrorResponse); 38 | public const string AuthenticationProvider = nameof(AuthenticationProvider); 39 | public const string TokenCredential = nameof(TokenCredential); 40 | public const string LoggingHandler = nameof(LoggingHandler); 41 | public const string ExtensionMethod = nameof(ExtensionMethod); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Extensions/BaseRequestBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public static class BaseRequestBuilderExtensions 7 | { 8 | /// 9 | /// Returns the Path to use for the Resource property of Subscription object when creating a new subscription 10 | /// 11 | /// Current request builder 12 | /// URL to use for the Resource property of Subscription object when creating a new subscription 13 | public static string GetResourceSubscriptionPath(this IBaseRequestBuilder requestBuilder) 14 | { 15 | if (requestBuilder is null) 16 | { 17 | throw new ArgumentNullException(nameof(requestBuilder)); 18 | } 19 | 20 | var pathAndQuery = new Uri(requestBuilder.RequestUrl).PathAndQuery; 21 | return pathAndQuery.Substring(pathAndQuery.IndexOf('/', 1)); //skips first / to ignore the version 22 | } 23 | 24 | /// 25 | /// Applies an OData cast filter to the returned collection. 26 | /// 27 | /// 28 | /// Current request builder 29 | /// The OData type name 30 | /// Request builder with OData cast filter applied 31 | public static T WithODataCast(this T requestBuilder, string oDataCast) where T : IBaseRequestBuilder 32 | { 33 | if (requestBuilder is null) 34 | { 35 | throw new ArgumentNullException(nameof(requestBuilder)); 36 | } 37 | 38 | if (string.IsNullOrEmpty(oDataCast)) 39 | { 40 | throw new ArgumentException($"'{nameof(oDataCast)}' cannot be null or empty.", nameof(oDataCast)); 41 | } 42 | 43 | var updatedUrl = requestBuilder.AppendSegmentToRequestUrl(oDataCast); 44 | var updatedBuilder = (T)Activator.CreateInstance(requestBuilder.GetType(), updatedUrl, requestBuilder.Client); 45 | 46 | return updatedBuilder; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Extensions/BaseRequestExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public static class BaseRequestExtensions 7 | { 8 | /// 9 | /// Adds the Prefer header to include Immutable Ids in the response 10 | /// 11 | /// 12 | /// The for the request. 13 | /// 14 | public static T WithImmutableId(this T baseRequest) where T : IBaseRequest 15 | { 16 | if (baseRequest is null) 17 | { 18 | throw new ArgumentNullException(nameof(baseRequest)); 19 | } 20 | 21 | baseRequest.Headers.Add( 22 | new HeaderOption( 23 | RequestExtensionsConstants.Headers.PreferHeaderName, 24 | RequestExtensionsConstants.Headers.PreferHeaderImmutableIdValue) 25 | ); 26 | return baseRequest; 27 | } 28 | 29 | /// 30 | /// Applies the ConsistencyLevel header required for certain DirectoryObject queries. 31 | /// (https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-advanced-queries-for-directory-objects-are-now-generally-available/) 32 | /// 33 | /// 34 | /// The for the request. 35 | /// 36 | public static T WithEventualConsistency(this T baseRequest) where T : IBaseRequest 37 | { 38 | if (baseRequest is null) 39 | { 40 | throw new ArgumentNullException(nameof(baseRequest)); 41 | } 42 | 43 | baseRequest.Headers.Add( 44 | new HeaderOption( 45 | RequestExtensionsConstants.Headers.ConsistencyLevelHeaderName, 46 | RequestExtensionsConstants.Headers.ConsistencyLevelEventualValue) 47 | ); 48 | return baseRequest; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Extensions/GraphServiceClientExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public static class GraphServiceClientExtensions 7 | { 8 | public static ISharePointAPIRequestBuilder SharePointAPI(this GraphServiceClient graphServiceClient, string siteUrl) 9 | { 10 | if (graphServiceClient is null) 11 | { 12 | throw new ArgumentNullException(nameof(graphServiceClient)); 13 | } 14 | 15 | if (string.IsNullOrEmpty(siteUrl)) 16 | { 17 | throw new System.ArgumentException($"'{nameof(siteUrl)}' cannot be null or empty.", nameof(siteUrl)); 18 | } 19 | 20 | return new SharePointAPIRequestBuilder(siteUrl, graphServiceClient); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Extensions/RequestExtensionsConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public static class RequestExtensionsConstants 4 | { 5 | #pragma warning disable CA1034 // Nested types should not be visible 6 | #pragma warning disable CA1724 // Type names should not match namespaces 7 | 8 | public static class Headers 9 | { 10 | public const string PreferHeaderName = "Prefer"; 11 | public const string PreferHeaderImmutableIdValue = "IdType=\"ImmutableId\""; 12 | 13 | public const string ConsistencyLevelHeaderName = "ConsistencyLevel"; 14 | public const string ConsistencyLevelEventualValue = "eventual"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Extensions/UserRequestBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public static class UserRequestBuilderExtensions 7 | { 8 | public static IUserMailboxSettingsRequestBuilder MailboxSettings(this IUserRequestBuilder builder) 9 | { 10 | if (builder is null) 11 | { 12 | throw new ArgumentNullException(nameof(builder)); 13 | } 14 | 15 | return new UserMailboxSettingsRequestBuilder(builder.AppendSegmentToRequestUrl("mailboxSettings"), builder.Client); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Graph.Community.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | latest 5 | netstandard2.0 6 | false 7 | README.md 8 | MIT 9 | https://github.com/microsoftgraph/msgraph-sdk-dotnet-contrib 10 | graph-community.png 11 | https://github.com/microsoftgraph/msgraph-sdk-dotnet-contrib 12 | graph community extensions dotnetcore 13 | Community Extensions to Graph SDK 14 | true 15 | true 16 | embedded 17 | 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/Middleware/IHttpMessageLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Graph.Community 4 | { 5 | public interface IHttpMessageLogger 6 | { 7 | Task WriteLine(string value); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Middleware/LoggingMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Net.Http; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Graph.Community 7 | { 8 | public class LoggingMessageHandler : DelegatingHandler 9 | { 10 | private readonly IHttpMessageLogger logger; 11 | 12 | public LoggingMessageHandler() 13 | : this(null) 14 | { 15 | } 16 | 17 | public LoggingMessageHandler(IHttpMessageLogger logger, HttpMessageHandler innerHandler = null) 18 | { 19 | InnerHandler = innerHandler ?? new HttpClientHandler(); 20 | this.logger = logger ?? new NullHttpMessageLogger(); 21 | } 22 | 23 | protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 24 | { 25 | if (request.Content != null) 26 | { 27 | await request.Content.LoadIntoBufferAsync(); 28 | } 29 | 30 | using (var messageFormatter = new HttpMessageFormatter(request)) 31 | { 32 | await logger.WriteLine(await messageFormatter.ReadAsStringAsync()); 33 | await logger.WriteLine(""); 34 | } 35 | 36 | var stopWatch = new Stopwatch(); 37 | stopWatch.Start(); 38 | 39 | var response = await base.SendAsync(request, cancellationToken); 40 | 41 | stopWatch.Stop(); 42 | 43 | if (response.Content != null) 44 | { 45 | await response.Content.LoadIntoBufferAsync(); 46 | } 47 | using (var messageFormatter = new HttpMessageFormatter(response)) 48 | { 49 | await logger.WriteLine(await messageFormatter.ReadAsStringAsync()); 50 | await logger.WriteLine(""); 51 | await logger.WriteLine("Roundtrip (ms): " + stopWatch.ElapsedMilliseconds); 52 | await logger.WriteLine("================================================"); 53 | } 54 | 55 | return response; 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Middleware/NullHttpMessageLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Graph.Community 4 | { 5 | class NullHttpMessageLogger : IHttpMessageLogger 6 | { 7 | public Task WriteLine(string value) 8 | { 9 | return Task.CompletedTask; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Middleware/Options/SharePointServiceHandlerOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class SharePointServiceHandlerOption : IMiddlewareOption 6 | { 7 | public bool DisableTelemetry { get; set; } 8 | public string ResourceUri { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/Change.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Microsoft.Graph; 4 | 5 | namespace Graph.Community 6 | { 7 | [DebuggerDisplay("{ODataType, nq}")] 8 | [SPDerivedTypeConverter(typeof(SPODataTypeConverter))] 9 | public class Change : BaseItem 10 | { 11 | public ChangeToken ChangeToken { get; set; } 12 | public ChangeType ChangeType { get; set; } 13 | public Guid SiteId { get; set; } 14 | public DateTime Time { get; set; } 15 | 16 | public Change() 17 | : base() 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Graph.Community 4 | { 5 | public class ChangeItem : Change 6 | { 7 | public int ItemId { get; set; } 8 | public string Editor { get; set; } 9 | public string EditorEmailHint { get; set; } 10 | public Guid ListId { get; set; } 11 | public Guid UniqueId { get; set; } 12 | public Guid WebId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Graph.Community 4 | { 5 | public class ChangeList : Change 6 | { 7 | public int BaseTemplate { get; set; } 8 | public bool Hidden { get; set; } 9 | public Guid ListId { get; set; } 10 | public string Title { get; set; } 11 | public Guid WebId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeSite.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class ChangeSite : Change 4 | { 5 | public ChangeSite() 6 | : base() 7 | { 8 | } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeToken.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class ChangeToken 4 | { 5 | public string StringValue { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeType.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public enum ChangeType 4 | { 5 | NoChange, 6 | Add, 7 | Update, 8 | DeleteObject, 9 | Rename, 10 | MoveAway, 11 | MoveInto, 12 | Restore, 13 | RoleAdd, 14 | RoleDelete, 15 | RoleUpdate, 16 | AssignmentAdd, 17 | AssignmentDelete, 18 | MemberAdd, 19 | MemberDelete, 20 | SystemUpdate, 21 | Navigation, 22 | ScopeAdd, 23 | ScopeDelete, 24 | ListContentTypeAdd, 25 | ListContentTypeDelete, 26 | Dirty, 27 | Activity 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeUser.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class ChangeUser : Change 4 | { 5 | public bool Activate { get; set; } 6 | public int UserId { get; set; } 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Models/ChangeLog/ChangeWeb.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Graph.Community 4 | { 5 | public class ChangeWeb : Change 6 | { 7 | public Guid WebId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Models/Form.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public class Form : BaseItem 7 | { 8 | public PageType FormType { get; set; } 9 | 10 | public new Guid Id { get; set; } 11 | 12 | public string ServerRelativeUrl { get; set; } 13 | } 14 | 15 | public enum PageType 16 | { 17 | Invalid = -1, 18 | DefaultView = 0, 19 | NormalView = 1, 20 | DialogView = 2, 21 | View = 3, 22 | DisplayForm = 4, 23 | DisplayFormDialog = 5, 24 | EditForm = 6, 25 | EditFormDialog = 7, 26 | NewForm = 8, 27 | NewFormDialog = 9, 28 | SolutionForm = 10, 29 | PAGE_MAXITEMS = 11 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Models/Group.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Graph.Community 5 | { 6 | [SPDerivedTypeConverter(typeof(SPODataTypeConverter))] 7 | public class Group : Principal 8 | { 9 | [JsonPropertyName("AllowMembersEditMembership")] 10 | public bool AllowMembersEditMembership { get; set; } 11 | 12 | [JsonPropertyName("AllowRequestToJoinLeave")] 13 | public bool AllowRequestToJoinLeave { get; set; } 14 | 15 | [JsonPropertyName("AutoAcceptRequestToJoinLeave")] 16 | public bool AutoAcceptRequestToJoinLeave { get; set; } 17 | 18 | [JsonPropertyName("Description")] 19 | public new string Description { get; set; } 20 | 21 | [JsonPropertyName("OnlyAllowMembersViewMembership")] 22 | public bool OnlyAllowMembersViewMembership { get; set; } 23 | 24 | [JsonPropertyName("Owner@odata.navigationLink")] 25 | public string OwnerNavigationLink { get; set; } 26 | 27 | [JsonPropertyName("Owner")] 28 | public Principal Owner { get; set; } 29 | 30 | [JsonPropertyName("OwnerTitle")] 31 | public string OwnerTitle { get; set; } 32 | 33 | [JsonPropertyName("RequestToJoinLeaveEmailSetting")] 34 | public string RequestToJoinLeaveEmailSetting { get; set; } 35 | 36 | [JsonPropertyName("Users@odata.navigationLink")] 37 | public string UsersNavigationLink { get; set; } 38 | 39 | [JsonPropertyName("Users")] 40 | public List Users { get; private set; } 41 | 42 | public Group() 43 | { 44 | this.Users = new List(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/ApplySiteDesignRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class ApplySiteDesignRequest 4 | { 5 | /// 6 | /// Id of the site design to apply 7 | /// 8 | public string SiteDesignId { get; set; } 9 | 10 | /// 11 | /// Absolute URL of site (site collection root) to which design is applied 12 | /// 13 | public string WebUrl { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/ApplySiteDesignResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Graph.Community 6 | { 7 | public class ApplySiteDesignResponse 8 | { 9 | [JsonPropertyName("value")] 10 | public List ActionOutcomes { get; } 11 | 12 | public ApplySiteDesignResponse() 13 | { 14 | this.ActionOutcomes = new List(); 15 | } 16 | } 17 | 18 | [DebuggerDisplay("{Title, nq}")] 19 | public class SiteScriptActionResult 20 | { 21 | [JsonPropertyName("Outcome")] 22 | [JsonConverter(typeof(SPEnumIntAsStringConverter))] 23 | public SiteScriptActionOutcome Outcome { get; set; } 24 | 25 | [JsonPropertyName("OutcomeText")] 26 | public string OutcomeText { get; set; } 27 | 28 | [JsonPropertyName("Title")] 29 | public string Title { get; set; } 30 | 31 | public SiteScriptActionResult() 32 | { 33 | } 34 | } 35 | 36 | public enum SiteScriptActionOutcome 37 | { 38 | Success, 39 | Failure, 40 | NoOp, 41 | SucceededWithException 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/CreateSiteDesignRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Graph.Community 6 | { 7 | public class CreateSiteDesignRequest 8 | { 9 | public Info info { get; set; } 10 | 11 | public CreateSiteDesignRequest(SiteDesignMetadata siteDesignMetadata) 12 | { 13 | if (siteDesignMetadata == null) 14 | { 15 | throw new ArgumentNullException(nameof(siteDesignMetadata)); 16 | } 17 | 18 | info = new Info 19 | { 20 | Title = siteDesignMetadata.Title, 21 | Description = siteDesignMetadata.Description, 22 | SiteScriptIds = siteDesignMetadata.SiteScriptIds, 23 | WebTemplate = siteDesignMetadata.WebTemplate, 24 | PreviewImageUrl = siteDesignMetadata.PreviewImageUrl, 25 | PreviewImageAltText = siteDesignMetadata.PreviewImageAltText, 26 | ThumbnailUrl = siteDesignMetadata.ThumbnailUrl, 27 | }; 28 | 29 | } 30 | 31 | public class Info 32 | { 33 | [JsonPropertyName("Title")] 34 | public string Title { get; set; } 35 | 36 | [JsonPropertyName("Description")] 37 | public string Description { get; set; } 38 | 39 | [JsonPropertyName("SiteScriptIds")] 40 | public List SiteScriptIds { get; set; } 41 | 42 | [JsonPropertyName("WebTemplate")] 43 | public string WebTemplate { get; set; } 44 | 45 | [JsonPropertyName("PreviewImageUrl")] 46 | public string PreviewImageUrl { get; set; } 47 | 48 | [JsonPropertyName("PreviewImageAltText")] 49 | public string PreviewImageAltText { get; set; } 50 | 51 | [JsonPropertyName("ThumbnailUrl")] 52 | public string ThumbnailUrl { get; set; } 53 | } 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/GetChangesRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class GetChangesRequest 4 | { 5 | public ChangeQuery Query { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/SiteDesignRequestInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Graph.Community 6 | { 7 | public class SiteDesignRequestInfo 8 | { 9 | [JsonPropertyName("Title")] 10 | public string Title { get; set; } 11 | 12 | [JsonPropertyName("Description")] 13 | public string Description { get; set; } 14 | 15 | [JsonPropertyName("SiteScriptIds")] 16 | public List SiteScriptIds { get; set; } 17 | 18 | [JsonPropertyName("WebTemplate")] 19 | public string WebTemplate { get; set; } 20 | 21 | [JsonPropertyName("PreviewImageUrl")] 22 | public string PreviewImageUrl { get; set; } 23 | 24 | [JsonPropertyName("PreviewImageAltText")] 25 | public string PreviewImageAltText { get; set; } 26 | 27 | [JsonPropertyName("ThumbnailUrl")] 28 | public string ThumbnailUrl { get; set; } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/SiteScriptRequestInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Graph.Community 4 | { 5 | public class SiteScriptRequestInfo 6 | { 7 | [JsonPropertyName("Title")] 8 | public string Title { get; set; } 9 | 10 | [JsonPropertyName("Description")] 11 | public string Description { get; set; } 12 | 13 | [JsonPropertyName("Version")] 14 | public int? Version { get; set; } 15 | 16 | [JsonPropertyName("Content")] 17 | public string Content { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/StorageEntitiesResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Graph.Community 7 | { 8 | public class StorageEntitiesResponse 9 | { 10 | [JsonPropertyName("storageentitiesindex")] 11 | public string StorageEntitiesIndex { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/TenantSettingsResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Graph.Community 7 | { 8 | public class TenantSettingsResponse 9 | { 10 | [JsonPropertyName("CorporateCatalogUrl")] 11 | public string CorporateCatalogUrl { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/UpdateSiteDesignRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Graph.Community 5 | { 6 | public class UpdateSiteDesignRequest 7 | { 8 | public Info updateInfo { get; set; } 9 | 10 | public UpdateSiteDesignRequest(string siteDesignId, SiteDesignMetadata siteDesignMetadata) 11 | { 12 | if (siteDesignId is null) 13 | { 14 | throw new ArgumentNullException(nameof(siteDesignId)); 15 | } 16 | 17 | if (siteDesignMetadata == null) 18 | { 19 | throw new ArgumentNullException(nameof(siteDesignMetadata)); 20 | } 21 | 22 | updateInfo = new Info 23 | { 24 | Id = siteDesignId, 25 | Title = siteDesignMetadata.Title, 26 | Description = siteDesignMetadata.Description, 27 | SiteScriptIds = siteDesignMetadata.SiteScriptIds, 28 | WebTemplate = siteDesignMetadata.WebTemplate, 29 | PreviewImageUrl = siteDesignMetadata.PreviewImageUrl, 30 | PreviewImageAltText = siteDesignMetadata.PreviewImageAltText, 31 | ThumbnailUrl = siteDesignMetadata.ThumbnailUrl 32 | }; 33 | } 34 | 35 | 36 | public class Info : SiteDesignRequestInfo 37 | { 38 | [JsonPropertyName("Id")] 39 | public string Id { get; set; } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Models/HttpMessages/UpdateSiteScriptRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Graph.Community 5 | { 6 | public class UpdateSiteScriptRequest 7 | { 8 | public Info updateInfo { get; set; } 9 | 10 | public UpdateSiteScriptRequest(string siteScriptId, SiteScriptMetadata siteScriptMetadata) 11 | { 12 | if (siteScriptId is null) 13 | { 14 | throw new ArgumentNullException(nameof(siteScriptId)); 15 | } 16 | 17 | if (siteScriptMetadata == null) 18 | { 19 | throw new ArgumentNullException(nameof(siteScriptMetadata)); 20 | } 21 | 22 | updateInfo = new Info 23 | { 24 | Id = siteScriptId, 25 | Title = siteScriptMetadata.Title, 26 | Description = siteScriptMetadata.Description, 27 | Version = siteScriptMetadata.Version, 28 | Content = siteScriptMetadata.Content 29 | }; 30 | } 31 | 32 | 33 | public class Info : SiteScriptRequestInfo 34 | { 35 | [JsonPropertyName("Id")] 36 | public string Id { get; set; } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Models/List.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class List : BaseItem 6 | { 7 | public new string Id { get; set; } 8 | public string Title { get; set; } 9 | public int BaseTemplate { get; set; } 10 | public System.Collections.Generic.List
Forms { get; set; } 11 | public ChangeToken CurrentChangeToken { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldChoice.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldChoice : FieldMultiChoice 4 | { 5 | public ChoiceFormatType EditFormat { get; set; } 6 | } 7 | 8 | public enum ChoiceFormatType 9 | { 10 | Dropdown, 11 | RadioButtons 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldDateTime.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldDateTime : Field 4 | { 5 | public string DateFormat { get; set; } 6 | public CalendarType DateTimeCalendarType { get; set; } 7 | public DateTimeFieldFormatType DisplayFormat { get; set; } 8 | public DateTimeFieldFriendlyFormatType FriendlyDisplayFormat { get; set; } 9 | public string TimeFormat { get; set; } 10 | } 11 | 12 | public enum DateTimeFieldFormatType 13 | { 14 | DateOnly, 15 | DateTime 16 | } 17 | 18 | public enum DateTimeFieldFriendlyFormatType 19 | { 20 | Unspecified, 21 | Disabled, 22 | Relative 23 | } 24 | 25 | public enum CalendarType 26 | { 27 | None = 0, 28 | Gregorian = 1, 29 | Japan = 3, 30 | Taiwan = 4, 31 | Korea = 5, 32 | Hijri = 6, 33 | Thai = 7, 34 | Hebrew = 8, 35 | GregorianMEFrench = 9, 36 | GregorianArabic = 10, 37 | GregorianXLITEnglish = 11, 38 | GregorianXLITFrench = 12, 39 | KoreaJapanLunar = 14, 40 | ChineseLunar = 15, 41 | SakaEra = 16, 42 | UmAlQura = 23 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldLookup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Graph.Community 6 | { 7 | public class FieldLookup : Field 8 | { 9 | public bool AllowMultipleValues { get; set; } 10 | public IList DependentLookupInternalNames { get; set; } 11 | public bool IsDependentLookup { get; set; } 12 | public bool IsRelationship { get; set; } 13 | public string LookupField { get; set; } 14 | public string LookupList { get; set; } 15 | public Guid LookupWebId { get; set; } 16 | public string PrimaryFieldId { get; set; } 17 | public RelationshipDeleteBehaviorType RelationshipDeleteBehavior { get; set; } 18 | public bool UnlimitedLengthInDocumentLibrary { get; set; } 19 | } 20 | public enum RelationshipDeleteBehaviorType 21 | { 22 | None, 23 | Cascade, 24 | Restrict 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldMultiChoice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Text; 5 | 6 | namespace Graph.Community 7 | { 8 | public class FieldMultiChoice : Field 9 | { 10 | 11 | public string[] Choices { get; set; } 12 | public bool FillInChoice { get; set; } 13 | public string Mappings { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldMultiLineText.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | class FieldMultiLineText:Field 4 | { 5 | public bool AllowHyperlink { get; set; } 6 | public bool AppendOnly { get; set; } 7 | public bool IsLongHyperlink { get; set; } 8 | public int NumberOfLines { get; set; } 9 | public bool RestrictedMode { get; set; } 10 | public bool RichText { get; set; } 11 | public bool UnlimitedLengthInDocumentLibrary { get; set; } 12 | public bool WikiLinking { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldNumber.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldNumber : Field 4 | { 5 | public bool CommaSeparator { get; set; } 6 | public string CustomUnitName { get; set; } 7 | public bool CustomUnitOnRight { get; set; } 8 | public int DisplayFormat { get; set; } 9 | public double MaximumValue { get; set; } 10 | public double MinimumValue { get; set; } 11 | public bool ShowAsPercentage { get; set; } 12 | public string Unit { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldTaxonomy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Graph.Community 4 | { 5 | public class FieldTaxonomy: Field 6 | { 7 | public Guid AnchorId { get; set; } 8 | public bool CreateValuesInEditForm { get; set; } 9 | public bool IsAnchorValid { get; set; } 10 | public bool IsDocTagsEnabled { get; set; } 11 | public bool IsKeyword { get; set; } 12 | public bool IsPathRendered { get; set; } 13 | public bool IsTermSetValid { get; set; } 14 | public bool Open { get; set; } 15 | public Guid SspId { get; set; } 16 | public string TargetTemplate { get; set; } 17 | public Guid TermSetId { get; set; } 18 | public Guid TextField { get; set; } 19 | public bool UserCreated { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldText.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldText: Field 4 | { 5 | public int MaxLength { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldUrl.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldUrl:Field 4 | { 5 | public UrlFieldFormatType DisplayFormat { get; set; } 6 | } 7 | 8 | public enum UrlFieldFormatType 9 | { 10 | Hyperlink, 11 | Image 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Models/ListField/FieldUser.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public class FieldUser : FieldLookup 4 | { 5 | public bool AllowDisplay { get; set; } 6 | public bool Presence { get; set; } 7 | public int SelectionGroup { get; set; } 8 | public FieldUserSelectionMode SelectionMode { get; set; } 9 | public string UserDisplayOptions { get; set; } 10 | } 11 | 12 | public enum FieldUserSelectionMode 13 | { 14 | PeopleOnly, 15 | PeopleAndGroups, 16 | GroupsOnly 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Models/ListItem.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class ListItem : BaseItem 6 | { 7 | public new int Id { get; set; } 8 | 9 | public string Title { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Models/Navigation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class Navigation : BaseItem 6 | { 7 | public bool UseShared { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Models/NavigationNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | using Microsoft.Graph; 4 | 5 | namespace Graph.Community 6 | { 7 | [JsonConverter(typeof(SPNavigationNodeConverter))] 8 | public class NavigationNode : BaseItem 9 | { 10 | [JsonPropertyName("Id")] 11 | public new int Id { get; set; } 12 | 13 | [JsonPropertyName("Title")] 14 | public string Title { get; set; } 15 | 16 | [JsonPropertyName("Url")] 17 | public Uri Url { get; set; } 18 | 19 | [JsonPropertyName("IsDocLib")] 20 | public bool IsDocLib { get; set; } 21 | 22 | [JsonPropertyName("IsExternal")] 23 | public bool IsExternal { get; set; } 24 | 25 | [JsonPropertyName("IsVisible")] 26 | public bool IsVisible { get; set; } 27 | 28 | [JsonPropertyName("ListTemplateType")] 29 | public int ListTemplateType { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Models/NavigationNodeCreationInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Graph.Community 5 | { 6 | public class NavigationNodeCreationInformation 7 | { 8 | [JsonPropertyName("Title")] 9 | public string Title { get; set; } 10 | 11 | [JsonPropertyName("Url")] 12 | public Uri Url { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/Principal.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public class Principal : BaseItem 7 | { 8 | /// 9 | /// Gets a value that specifies the member identifier for the user or group. 10 | /// 11 | [JsonPropertyName("Id")] 12 | public new int Id { get; set; } 13 | 14 | /// 15 | /// Gets a value that indicates whether this member should be hidden in the UI. 16 | /// 17 | [JsonPropertyName("IsHiddenInUI")] 18 | public bool IsHiddenInUI { get; set; } 19 | 20 | /// 21 | /// Gets a value containing the type of the principal. Represents a bitwise SP.PrincipalType value: None = 0; User = 1; DistributionList = 2; SecurityGroup = 4; SharePointGroup = 8; All = 15. 22 | /// 23 | [JsonPropertyName("PrincipalType")] 24 | public SPPrincipalType PrincipalType { get; set; } 25 | 26 | /// 27 | /// Gets the login name of the user. 28 | /// 29 | [JsonPropertyName("LoginName")] 30 | public string LoginName { get; set; } 31 | 32 | /// 33 | /// Gets or sets a value that specifies the name of the principal. 34 | /// 35 | [JsonPropertyName("Title")] 36 | public string Title { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Models/SPPrincipalType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Graph.Community 4 | { 5 | [Flags] 6 | public enum SPPrincipalType 7 | { 8 | /// 9 | /// Enumeration whose value specifies no principal type 10 | /// 11 | None = 0, 12 | 13 | /// 14 | /// Enumeration whose value specifies a user as the principal type 15 | /// 16 | User = 1, 17 | 18 | /// 19 | /// Enumeration whose value specifies a distribution list as the principal type 20 | /// 21 | DistributionList = 2, 22 | 23 | /// 24 | /// Enumeration whose value specifies a security group as the principal type 25 | /// 26 | SecurityGroup = 4, 27 | 28 | /// 29 | /// Enumeration whose value specifies a group as the principal type 30 | /// 31 | SharePointGroup = 8, 32 | 33 | /// 34 | /// Enumeration whose value specifies all principal types 35 | /// 36 | All = 15 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Models/SearchResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Graph.Community 5 | { 6 | public class SearchResult 7 | { 8 | public Uri OdataMetadata { get; set; } 9 | 10 | public long ElapsedTime { get; set; } 11 | 12 | public PrimaryQueryResult PrimaryQueryResult { get; set; } 13 | 14 | public List Properties { get; set; } 15 | 16 | public List SecondaryQueryResults { get; set; } 17 | 18 | public string SpellingSuggestion { get; set; } 19 | 20 | public List TriggeredRules { get; set; } 21 | } 22 | 23 | public class PrimaryQueryResult 24 | { 25 | public List CustomResults { get; set; } 26 | 27 | public Guid QueryId { get; set; } 28 | 29 | public Guid QueryRuleId { get; set; } 30 | 31 | public object RefinementResults { get; set; } 32 | 33 | public RelevantResults RelevantResults { get; set; } 34 | 35 | public object SpecialTermResults { get; set; } 36 | } 37 | 38 | public class RelevantResults 39 | { 40 | public object GroupTemplateId { get; set; } 41 | 42 | public object ItemTemplateId { get; set; } 43 | 44 | public List Properties { get; set; } 45 | 46 | public object ResultTitle { get; set; } 47 | 48 | public object ResultTitleUrl { get; set; } 49 | 50 | public long RowCount { get; set; } 51 | 52 | public Table Table { get; set; } 53 | 54 | public long TotalRows { get; set; } 55 | 56 | public long TotalRowsIncludingDuplicates { get; set; } 57 | } 58 | 59 | public class Table 60 | { 61 | public List Rows { get; set; } 62 | } 63 | 64 | public class Row 65 | { 66 | public List Cells { get; set; } 67 | } 68 | 69 | public class ResultKeyValuePair 70 | { 71 | public string Key { get; set; } 72 | 73 | public string Value { get; set; } 74 | 75 | public string ValueType { get; set; } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Models/Site.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class Site : BaseItem 6 | { 7 | public string Classification { get; set; } 8 | 9 | public string GroupId { get; set; } 10 | 11 | public string HubSiteId { get; set; } 12 | 13 | public bool IsHubSite { get; set; } 14 | 15 | public string ServerRelativeUrl { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Models/SiteDesignRun.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Graph; 3 | 4 | namespace Graph.Community 5 | { 6 | public class SiteDesignRun : BaseItem 7 | { 8 | public Guid SiteDesignId { get; set; } 9 | 10 | public string SiteDesignTitle { get; set; } 11 | 12 | public int SiteDesignVersion { get; set; } 13 | 14 | public Guid SiteId { get; set; } 15 | 16 | public Guid WebId { get; set; } 17 | 18 | /// 19 | /// StartTime - Appears to be the Unix Epoch timestamp 20 | /// 21 | public Int64 StartTime { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Models/SitePage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | using Microsoft.Graph; 4 | 5 | namespace Graph.Community 6 | { 7 | public class SitePage : BaseItem 8 | { 9 | public new int Id { get; set; } 10 | 11 | public string Title { get; set; } 12 | 13 | public SitePagePromotedState PromotedState { get; set; } 14 | 15 | [JsonPropertyName("FirstPublished")] 16 | public DateTimeOffset? FirstPublishedDateTime 17 | { 18 | get 19 | { 20 | // "FirstPublished": "0001-01-01T08:00:00Z", 21 | if (firstPublished.HasValue && firstPublished.Value == SitePage.NULL_PUBLISHED_DATE) 22 | { 23 | return null; 24 | } 25 | return firstPublished; 26 | } 27 | set 28 | { 29 | firstPublished = value; 30 | } 31 | } 32 | private DateTimeOffset? firstPublished; 33 | private static DateTimeOffset NULL_PUBLISHED_DATE = new DateTimeOffset(0001, 01, 01, 08, 00, 00, TimeSpan.Zero); 34 | 35 | [JsonPropertyName("Modified")] 36 | public new DateTimeOffset? LastModifiedDateTime { get; set; } 37 | 38 | public string FileName { get; set; } 39 | 40 | public string AbsoluteUrl { get; set; } 41 | 42 | public string BannerImageUrl { get; set; } 43 | 44 | public string BannerThumbnailUrl { get; set; } 45 | 46 | public string Url { get; set; } 47 | 48 | public string UniqueId { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Models/SitePageCheckoutType.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | public enum SitePageCheckoutType 4 | { 5 | /// 6 | ///The file is checked out for editing on the server. 7 | /// 8 | Online, 9 | /// 10 | ///The file is checked out for editing on the local computer. 11 | /// 12 | Offline, 13 | /// 14 | ///The file is not checked out. 15 | /// 16 | None 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Models/SitePageModerationStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Graph.Community 6 | { 7 | public enum SitePageModerationStatus 8 | { 9 | /// 10 | /// The list item is approved. 11 | /// 12 | Approved, 13 | /// 14 | /// The list item has been denied approval. 15 | /// 16 | Denied, 17 | /// 18 | /// The list item is pending approval. 19 | /// 20 | Pending, 21 | /// 22 | /// The list item is in the draft or checked out state. 23 | /// 24 | Draft, 25 | /// 26 | /// The list item is scheduled for automatic approval at a future date. 27 | /// 28 | Scheduled 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Models/SitePagePromotedState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Graph.Community 6 | { 7 | public enum SitePagePromotedState 8 | { 9 | /// 10 | /// Regular page 11 | /// 12 | NotPromoted = 0, 13 | 14 | /// 15 | /// Page that will be promoted as news article after publishing 16 | /// 17 | PromoteOnPublish = 1, 18 | 19 | /// 20 | /// Page that is promoted as news article 21 | /// 22 | Promoted = 2 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Models/SitePagePublishedStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Graph.Community 2 | { 3 | /// 4 | /// Indicates if a file was published, draft or checked out 5 | /// 6 | public enum SitePagePublishedStatus 7 | { 8 | /// 9 | /// File is published 10 | /// 11 | Published = 1, 12 | 13 | /// 14 | /// File is in draft 15 | /// 16 | Draft = 2, 17 | 18 | /// 19 | /// File is checked out 20 | /// 21 | Checkout = byte.MaxValue 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Models/SitePageVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | using Microsoft.Graph; 4 | 5 | namespace Graph.Community 6 | { 7 | public class SitePageVersion : BaseItem 8 | { 9 | public new int Id { get; set; } 10 | 11 | //public string CheckInComment { get; set; } 12 | public DateTime Created { get; set; } 13 | public bool IsCurrentVersion { get; set; } 14 | 15 | // Refer to https://github.com/pnp/pnpcore/issues/581 16 | //public int Length { get; set; } 17 | 18 | public long Size { get; set; } 19 | 20 | public string VersionLabel { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Models/SiteScriptMetadata.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Graph; 2 | 3 | namespace Graph.Community 4 | { 5 | public class SiteScriptMetadata : BaseItem 6 | { 7 | /// 8 | /// The display name of the site script. 9 | /// 10 | public string Title { get; set; } 11 | 12 | public int Version { get; set; } 13 | 14 | public string Content { get; set; } 15 | public bool IsSiteScriptPackage { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Models/StorageEntity.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Graph.Community 4 | { 5 | public class StorageEntity 6 | { 7 | [JsonPropertyName("Comment")] 8 | public string Comment { get; set; } 9 | 10 | [JsonPropertyName("Description")] 11 | public string Description { get; set; } 12 | 13 | [JsonPropertyName("Value")] 14 | public string Value { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Models/User.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Graph.Community 4 | { 5 | [SPDerivedTypeConverter(typeof(SPODataTypeConverter))] 6 | public class User : Principal 7 | { 8 | [JsonPropertyName("Email")] 9 | public string Email { get; set; } 10 | 11 | /// 12 | /// Gets or sets a Boolean value that specifies whether the user is a site collection administrator. 13 | /// 14 | [JsonPropertyName("IsSiteAdmin")] 15 | public bool IsSiteAdmin { get; set; } 16 | 17 | [JsonPropertyName("IsEmailAuthenticationGuestUser")] 18 | public bool IsEmailAuthenticationGuestUser { get; set; } 19 | 20 | [JsonPropertyName("IsShareByEmailGuestUser")] 21 | public bool IsShareByEmailGuestUser { get; set; } 22 | 23 | [JsonPropertyName("UserPrincipalName")] 24 | public string UserPrincipalName { get; set; } 25 | 26 | [JsonPropertyName("UserId")] 27 | public UserId UserId { get; set; } 28 | } 29 | 30 | public class UserId 31 | { 32 | [JsonPropertyName("NameId")] 33 | public string NameId { get; set; } 34 | [JsonPropertyName("NameIdIssuer")] 35 | public string NameIdIssuer { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Models/UserInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Graph.Community 6 | { 7 | public class UserInfo 8 | { 9 | public int Id { get; set; } 10 | public string Title { get; set; } 11 | public string Name { get; set; } 12 | public string Email { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/Web.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Graph.Community.Models; 4 | using Microsoft.Graph; 5 | 6 | namespace Graph.Community 7 | { 8 | [SPDerivedTypeConverter(typeof(SPODataTypeConverter))] 9 | public class Web : BaseItem 10 | { 11 | [JsonPropertyName("Id")] 12 | public new string Id { get; set; } 13 | 14 | [JsonPropertyName("Title")] 15 | public string Title { get; set; } 16 | 17 | [JsonPropertyName("CurrentChangeToken")] 18 | public ChangeToken CurrentChangeToken { get; set; } 19 | 20 | [JsonPropertyName("UsersNavigationLink")] 21 | public string UsersNavigationLink { get; set; } 22 | 23 | [JsonPropertyName("Users")] 24 | public List Users { get; } 25 | 26 | [JsonPropertyName("AssociatedMemberGroupNavigationLink")] 27 | public string AssociatedMemberGroupNavigationLink { get; set; } 28 | 29 | [JsonPropertyName("AssociatedMemberGroup")] 30 | public Group AssociatedMemberGroup { get; set; } 31 | 32 | [JsonPropertyName("AssociatedOwnerGroupNavigationLink")] 33 | public string AssociatedOwnerGroupNavigationLink { get; set; } 34 | 35 | [JsonPropertyName("AssociatedOwnerGroup")] 36 | public Group AssociatedOwnerGroup { get; set; } 37 | 38 | [JsonPropertyName("AssociatedVisitorGroupNavigationLink")] 39 | public string AssociatedVisitorGroupNavigationLink { get; set; } 40 | 41 | [JsonPropertyName("AssociatedVisitorGroup")] 42 | public Group AssociatedVisitorGroup { get; set; } 43 | 44 | [JsonPropertyName("WelcomePage")] 45 | public string WelcomePage { get; set; } 46 | 47 | [JsonPropertyName("RegionalSettings")] 48 | public RegionalSettings RegionalSettings { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Requests/AppCatalog/AppCatalogUrlRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.Graph; 6 | using System.Threading.Tasks; 7 | using System.Threading; 8 | using Azure; 9 | 10 | namespace Graph.Community 11 | { 12 | public class AppCatalogUrlRequest:BaseSharePointAPIRequest, IAppCatalogUrlRequest 13 | { 14 | public AppCatalogUrlRequest( 15 | string requestUrl, 16 | IBaseClient client, 17 | IEnumerable