https://github.com/scalable-dynamics/more-365
https://github.com/scalable-dynamics/more-365
api aspnetcore authentication azure azuread batch csharp dotnetcore dynamics entity fetch fetchxml function graph metadata microsoft office365 powerapps sharepoint xrm
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/scalable-dynamics/more-365
- Owner: scalable-dynamics
- License: mit
- Created: 2019-01-27T21:20:52.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-10-18T20:59:48.000Z (over 2 years ago)
- Last Synced: 2026-02-17T06:30:22.785Z (4 months ago)
- Topics: api, aspnetcore, authentication, azure, azuread, batch, csharp, dotnetcore, dynamics, entity, fetch, fetchxml, function, graph, metadata, microsoft, office365, powerapps, sharepoint, xrm
- Language: C#
- Size: 43 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# more-365
Create more applications using the Microsoft 365 platform
> more-365 enables communicating with Microsoft 365 services from a server-side application (aspnetcore / Azure Functions)
For Example: Azure AD Authentication using Certificates from Key Vault, Dynamics 365 Queries + Batches, SharePoint File Upload / Download, Graph API convert to PDF + send email
License: [MIT](http://www.opensource.org/licenses/mit-license.php)
## Nuget.org
The package name is more-365, you can find it here:
[](https://www.nuget.org/packages/more365)
Packages for each individual component:
### more365.AzureAD
[](https://www.nuget.org/packages/more365.AzureAD)
### more365.Dynamics
[](https://www.nuget.org/packages/more365.Dynamics)
### more365.Graph
[](https://www.nuget.org/packages/more365.Graph)
### more365.SharePoint
[](https://www.nuget.org/packages/more365.SharePoint)
...
## C# Example
```c#
public static async Task Execute(DynamicsClient dynamics, Guid entityId)
{
var query = dynamics.CreateQuery()
.Select(e => new
{
e.CreatedBy,
e.CreatedOn
});
.Where(e => e.EntityId = entityId);
var fetchXml = query.ToFetchXml();
try
{
var queryResult = await dynamics.ExecuteQuery(query);
return queryResult.FirstOrDefault();
}
catch (DynamicsClientException ex)
{
throw new Exception(ex.Details);
}
}
```
## Interfaces
```c#
public interface IAuthenticationClient
{
Task GetAuthenticationTokenAsync(string resource);
Task GetAuthenticationTokenAsync(Uri resource);
}
public interface IAuthenticatedHttpClientFactory
{
HttpClient CreateAuthenticatedHttpClient(string resource, Guid? uniqueId = null);
}
public interface IMore365ClientFactory
{
IDynamicsClient CreateDynamicsClient(Guid? impersonateAzureADObjectId = null);
IGraphClient CreateGraphClient();
ISharePointClient CreateSharePointClient();
}
```
## Dynamics Interfaces
```c#
public interface IDynamicsClient
{
Task> ExecuteBatch(params BatchRequest[] requests);
Task> ExecuteQuery(string url);
Task ExecuteSingle(string url);
Task Get(string entitySetName, Guid id, params string[] columns);
Task Save(string entitySetName, object data, Guid? id = null);
}
public interface IXrmQueryExpression
{
IXrmQueryExpression Select(params string[] attributeNames);
IXrmQueryExpression Where(string attributeName, XrmQueryOperator expressionOperator, params object[] values);
IXrmQueryExpression WhereAny(Action or);
IXrmQueryExpression OrderBy(string attributeName, bool isDescendingOrder = false);
IXrmQueryExpression Join(string entityName, string attributeToName, string attributeFromName = "", bool isOuterJoin = false, string joinAlias = "");
}
```
## SharePoint & Graph Interfaces
```c#
public interface ISharePointClient
{
Task CreateFolder(string documentLibraryName, string folderPath);
Task DownloadFile(string filePath);
Task GetFilePreviewUrl(string filePath);
Task GetFolder(string documentLibraryName, string folderPath = "");
Task UploadFile(string fileName, byte[] file, string documentLibraryName, string folderPath = "");
}
public interface IGraphClient
{
Task DownloadFileAsPdf(string filePath);
Task SendOutlookEmail(string subject, string content, string fromSender, params string[] toRecipients);
}
```
## Configuration
```c#
public class More365Configuration
{
public Uri DynamicsUrl { get; set; }
public Uri SharePointUrl { get; set; }
public Guid AzureADTenantId { get; set; }
public Guid AzureADApplicationId { get; set; }
public string AzureADAppCertificateKey { get; set; }
public string AzureADAppClientSecretKey { get; set; }
}
public enum XrmQueryOperator
{
Contains,
NotContains,
StartsWith,
EndsWith,
Equals,
NotEquals,
GreaterThan,
GreaterThanOrEqual,
LessThan,
LessThanOrEqual,
In,
NotIn,
OnOrBefore,
OnOrAfter,
Null,
NotNull,
IsCurrentUser,
IsCurrentTeam,
IsNotCurrentUser,
IsNotCurrentTeam
}
```