A Comprehensive Guide to SharePoint Embedded Graph APIs
Tags: sharepoint
Published: 2024-07-02 06:30:00

Are you a developer looking to leverage the power of SharePoint Embedded in your applications? Managing files and documents within SharePoint Embedded containers is crucial for building robust solutions. This blog post is your one-stop guide to understanding SharePoint Embedded container and file Graph API methods!

![SharePoint Embedded API Endpoints Mindmap](https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e985d4a-b951-4453-ab09-a502a4e9a0ca_800x800.png)

We'll delve into the functionalities offered by these methods, categorized for easy comprehension. Whether you're a seasoned SharePoint developer or just starting out, this guide will equip you with the knowledge to effectively manage containers and files within your SharePoint Embedded applications.


## Managing Containers

SharePoint Embedded containers are the foundation for storing and managing files within your SharePoint Embedded applications. They act as secure file repositories where users can interact with documents.

This section dives deep into the functionalities offered by SharePoint Embedded container methods, categorized for clear understanding. By effectively utilizing these methods, you can create robust and user-friendly experiences within your applications.

Here's a breakdown of the container methods grouped based on their purpose:

- **Management:** Create, update, delete, and retrieve container properties.
- **Columns:** Manage columns within containers, which define the metadata structure for stored files.
- **Metadata:** Create, update, delete, and retrieve custom properties associated with the container itself.
- **Security:** Control permissions for accessing and modifying container content.
- **Availability:** Activate, lock, and unlock containers to manage their accessibility for users.
- **Deletion:** Permanently delete containers or restore them after deletion.


### Management

The management methods within SharePoint Embedded containers allow you to perform essential actions on the containers themselves. These methods grant you control over the container's lifecycle and properties. Here's a breakdown of the functionalities offered:

- **Create:** Establish a new SharePoint Embedded container. Define properties during creation (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post?view=graph-rest-beta)).
- **Update:** Modify the properties of an existing container (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update?view=graph-rest-beta)).
- **Get:** Retrieve the detailed properties of a specific container (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get?view=graph-rest-beta)).
- **List:** Enumerate all the containers associated with your SharePoint Embedded application (reference: [https://learn.microsoft.com/en-us/graph/api/filestorage-list-containers?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestorage-list-containers?view=graph-rest-beta)).
- **Delete:** Permanently remove a container from your SharePoint Embedded environment (reference: [https://learn.microsoft.com/en-us/graph/api/filestorage-delete-containers?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestorage-delete-containers?view=graph-rest-beta)).


### Columns

Columns within SharePoint Embedded containers play a crucial role in defining the metadata structure for the files stored within them. They act as labels or categories that help users organize and filter information associated with the files. Effectively managing columns allows you to create a well-structured and searchable file repository within your application.

Here's a breakdown of the functionalities offered by SharePoint Embedded container column methods:

- **Add:** Create a new column within a specific container. Define the column's properties during creation, such as its name, data type (text, number, choice, etc.), and whether it's mandatory or optional for users to provide data for that column (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-columns?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-columns?view=graph-rest-beta)).
- **Update:** Modify the properties of an existing column within the container. This might involve changing the column's name, data type, or other relevant attributes (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-column?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-column?view=graph-rest-beta)).
- **Get:** Retrieve the detailed properties of a specific column within a container. This is useful for obtaining information about an existing column (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get-column?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get-column?view=graph-rest-beta)).
- **List:** Enumerate all the columns defined within a particular SharePoint Embedded container. This provides a comprehensive list of available columns for managing file metadata (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-columns?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-columns?view=graph-rest-beta)).
- **Delete:** Permanently remove a column from a container. It's important to consider any existing data associated with the column before deleting it (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-column?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-column?view=graph-rest-beta)).


### Metadata

Beyond the columns you define, SharePoint Embedded containers allow you to manage custom properties associated with the container itself. This metadata provides additional ways to categorize and organize your containers within your application.

Here's a breakdown of the functionalities offered by SharePoint Embedded container metadata methods:

- **Add:** Create a new custom property for a specific container. Define the property's name, value and if is searchable during creation (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-customproperty?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-customproperty?view=graph-rest-beta)).
- **Update:** Modify the properties of an existing custom property within the container. This might involve changing the property's name, or its value (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-customproperty?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-customproperty?view=graph-rest-beta)).
- **List:** Enumerate all the custom properties defined for a particular SharePoint Embedded container. This provides a comprehensive list for managing container-specific metadata (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-customproperty?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-customproperty?view=graph-rest-beta)).
- **Delete:** Permanently remove a custom property from a container. It's important to consider the impact on any functionalities that rely on the custom property before deleting it (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-customproperty?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-customproperty?view=graph-rest-beta)).


### Security

Security is paramount when managing sensitive data within SharePoint Embedded containers. These methods ensure that only authorized users can access and modify the container's content.

Here's a breakdown of the functionalities offered by SharePoint Embedded container security methods:

- **Manage Permissions:** Grant, modify, and remove access levels (read, write, manager and owner) for specific users or groups on a container. This allows granular control over who can interact with the container's content. SharePoint Embedded offers the following methods for permission management:
    - **Add Permissions:** Assign specific access levels to users or groups for a container (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-permissions?view=graph-rest-beta)).
    - **Update Permissions:** Modify the existing access levels for users or groups on a container (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-permissions?view=graph-rest-beta)).
    - **Delete Permissions:** Revoke access for specific users or groups from a container (reference: https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-permissions?view=graph-rest-beta)).
    - **List Permissions:** Retrieve the current permission settings for a container, providing a clear picture of who has access and at what level (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-permissions?view=graph-rest-beta)).


### Availability

Managing the accessibility of SharePoint Embedded containers is crucial for various scenarios. These methods allow you to control whether users can interact with the content within a container.

Here's a breakdown of the functionalities offered by SharePoint Embedded container availability methods:

- **Activate:** Enable access to a container created recently. The container will be automatically removed if not activated in the 24 hours after being created. This allows users to interact with the container's content (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-activate?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-activate?view=graph-rest-beta)).
- **Lock:** Restrict access to a container, essentially putting it in a read-only state. Users wouldn't be able to modify or add files to the container while it's locked (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-update-permissions?view=graph-rest-beta)).
- **Unlock:** Grant users access to a container that was previously locked. This reverses the restrictions put in place by the Lock method (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-permissions?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-permissions?view=graph-rest-beta)).


### Deletion

Removing SharePoint Embedded containers requires careful consideration. These methods provide functionalities for managing the deletion process, including potential data recovery.

Here's a breakdown of the functionalities offered by SharePoint Embedded container deletion methods:

- **Delete:** Completely remove a container from the deleted containers, ensuring it cannot be recovered (reference: [https://learn.microsoft.com/en-us/graph/api/filestorage-delete-deletedcontainers?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestorage-delete-deletedcontainers?view=graph-rest-beta)).
- **Permanently Delete:** Permanently remove an active container from your SharePoint Embedded environment (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-permanentdelete?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-permanentdelete?view=graph-rest-beta)).
- **Restore from Deleted Containers:** Retrieve a container within the deleted containers collection (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-restore?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-restore?view=graph-rest-beta)).


## Interacting with Files

Having explored the functionalities for managing SharePoint Embedded containers themselves, let's delve into the world of files! While most interactions with individual files leverage standard Microsoft Graph endpoints, there are some functionalities specific to SharePoint Embedded containers, particularly when it comes to the recycle bin.

Here, we'll explore the various methods available for managing files within your containers, following the same structure we used for container management:

### Management

This category encompasses methods for obtaining information about the top-level container within SharePoint Embedded, which aligns with the concept of a `Drive` in Microsoft Graph.

- **Get Drive:** Retrieve the properties of the top-level container of a file system in Microsoft Graph, which is functionally equivalent to a `Container` in SharePoint Embedded (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get-drive?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-get-drive?view=graph-rest-beta)). This endpoint acts as a wrapper around the standard Microsoft Graph [Get drive](https://learn.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-beta) method, allowing you to utilize the `Container` identifier.

### Deletion

For managing files within the recycle bin of a specific container, SharePoint Embedded offers functionalities with a 93-day retention period:

- **Restore Recycle Bin Items:** Recover a set of files from a specific container's recycle bin, making them accessible to users again (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-restore-recyclebin-items?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-restore-recyclebin-items?view=graph-rest-beta)).
- **Delete Recycle Bin Items:** Permanently remove a file from the recycle bin of a specific container. These files will be unrecoverable (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-recyclebin-items?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-delete-recyclebin-items?view=graph-rest-beta)).
- **List Recycle Bin Items:** Enumerate the existing files within the recycle bin of a specific container (reference: [https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-recyclebin-items?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-recyclebin-items?view=graph-rest-beta)).


## Conclusion

In conclusion, SharePoint Embedded containers offer a powerful solution for managing document storage within your applications. This guide explored functionalities for creating, managing, and securing your containerized file repositories.

**Important Note:** Most methods explained here are part of the beta version of the Microsoft Graph API. While they showcase the future of SharePoint Embedded container management, they might not be finalized yet. Refer to official Microsoft Graph documentation for the latest information. Despite the beta status, SharePoint Embedded containers provide a robust foundation for managing files and data recovery. With ongoing development, expect even more advanced features in the future. By leveraging these functionalities, you can streamline document management within your applications, enhancing collaboration and data security for your users.


## References

- *fileStorageContainer resource type: [https://learn.microsoft.com/en-us/graph/api/resources/filestoragecontainer?view=graph-rest-beta](https://learn.microsoft.com/en-us/graph/api/resources/filestoragecontainer?view=graph-rest-beta)*
- *Getting to know SharePoint Embedded: [https://intranetfromthetrenches.substack.com/p/getting-to-know-sharepoint-embedded](https://intranetfromthetrenches.substack.com/p/getting-to-know-sharepoint-embedded)*
- *Project Concepts Driven by the Influence of SharePoint Embedded: [https://intranetfromthetrenches.substack.com/p/project-concepts-driven-by-sharepoint-embedded](https://intranetfromthetrenches.substack.com/p/project-concepts-driven-by-sharepoint-embedded)*
- *Two SharePoint Embedded Architectures You Must Know About: [https://intranetfromthetrenches.substack.com/p/sharepoint-embedded-architectures](https://intranetfromthetrenches.substack.com/p/sharepoint-embedded-architectures)*