Delete Services.ts

This commit is contained in:
Harsha Vardhini 2020-05-18 13:38:29 +05:30 committed by GitHub
parent edaf90930d
commit 713915d0a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 40 deletions

View File

@ -1,40 +0,0 @@
import { sp } from '../SPPreset';
import { Web } from '@pnp/sp/webs';
import { SearchResults } from '@pnp/sp/search';
import { WebPartContext } from '@microsoft/sp-webpart-base';
import { MSGraphClient } from "@microsoft/sp-http";
export default class Services {
public async getSiteNames(): Promise<SearchResults> {
const allSiteResults: SearchResults = await sp.search({
Querytext: "contentclass:STS_Site contentclass:STS_Web",
EnableInterleaving: true,
RowLimit: 100
});
return allSiteResults;
}
public getRootSiteURL(): Promise<string> {
return sp.web.get().then((data) => {
return data.ResourcePath.DecodedUrl;
});
}
public saveFileToSP(SiteURL: string, serverRelativeURL: string, filename: string, file): Promise<any> {
let web = Web(SiteURL);
return web.getFolderByServerRelativeUrl(serverRelativeURL).files.add(filename, file, true).then((result) => {
return result;
});
}
public getEmailContent(context: WebPartContext, id: string): Promise<any> {
return context.msGraphClientFactory.getClient().then((client: MSGraphClient): Promise< void> => {
return client.api('/me/messages/' + id + '/$value').version('v1.0').responseType('blob').get().then((response: any) => {
return response;
});
});
}
public getAllDocumentLibary(absoluteURL: string): Promise<any[]> {
return sp.site.getDocumentLibraries(absoluteURL).then((libraries: any[]) => {
return libraries;
});
}
}