I have imported the MSGraphClient in my project using the following statement:
import { MSGraphClient } from '@microsoft/sp-client-preview';
I have also added those two import statements, as I will be working with O365 groups:
import { Group } from '@microsoft/microsoft-graph-types';
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
So far my page is being rendered within the SharePoint workbench without errors. However, as soon as I declare the MSGraphClient in the following manner:
const graphClient: MSGraphClient = this.props.context.serviceScope.consume(MSGraphClient.serviceKey);
,
the page doesn't load anymore, but begins producing errors of this type:
This used to work in a past project of mine, I am not sure what has changed.
I considered importing the MSGraphClient from'@microsoft/sp-http'
as per the official documentation (https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph), but VS Code doesn't even allow me to do that.