有人知道如何通过MS Graph API创建excel和ppt文件吗?我们试图利用MS Graph API在单击按钮时创建word / excel / ppt文件,尽管我们发现了如何创建Word文件,但是即使api成功响应,所创建的excel和powerpoint文件也已损坏。下面的终点适用于Word文件。目前,我们仅与图api浏览器(https://developer.microsoft.com/en-us/graph/graph-explorer#)合作。任何帮助将不胜感激!
POST https://graph.microsoft.com/v1.0/drives/{Drive ID}/root/children/
Request Body:
{
"name": "FileTest6.docx",
"file":{
}
}
答案 0 :(得分:1)
PowerPoint文件
可以通过DriveItem upload端点创建PowerPoint文件,例如:
s = pd.Series([0,0,1,1,0,0,0,0,0,0,1,1,1,1,1])
print (s)
from itertools import groupby
a = [ list(group) for key, group in groupby(enumerate(s), key= lambda x:x[1]) if key]
print (a)
[[(2, 1), (3, 1)], [(10, 1), (11, 1), (12, 1), (13, 1), (14, 1)]]
L=[x[0] for x in max(a, key=len)]
out = [min(L), max(L)]
print (out)
[10, 14]
或
SELECT DISTINCT Membershipnumber as Id
,'P' as PartyType
,'A' as Status
,case
when Name = 'Standard Membership paid annually.' and EndDate > '2020-03-31' then 'Member'
when Name = 'Lapsed subscription renewal' and EndDate > '2020-03-31' then 'Member'
when Name = '3 Year Subscription (members outside of UK and Ireland, Jersey, Guernsey and the Channel Islands)' and EndDate > '2020-03-31' then 'Overseas member'
when Name = '1 Year Subscription (members outside of UK and Ireland, Jersey, Guernsey and the Channel Islands).' and EndDate > '2020-03-31' then 'Overseas member'
when Name = 'Lapsed subscription renewal' and EndDate > '2020-03-31' then 'Member'
when Name = 'Lifetime membership' then 'Lifetime member'
when Name = 'Retired membership paid annually' and EndDate > '2020-03-31' then 'Retired member'
else 'Non member'
end As MemberType
,Title as NamePrefix
,FirstName as FirstName
,Surname as LastName
,DateOfBirth as BirthDate
,'Home' as AddressPurpose
,'Default' as CommunicationReasons
,AddressLine1
,AddressLine2
,AddressLine3
,Addressline4 as CityName
,'' as CountrySubEntityName
,Country as CountryCode
,'' as CountryName
,Postcode as PostalCode
,EmailAddress as Email
FROM [dbo].[UserProfile]
inner join dbo.Subscription on
UserProfile.Id = Subscription.UserProfileId
inner join dbo.SubscriptionType on
SubscriptionType.id = Subscription.SubscriptionTypeId```
Excel文件
对于excel文件,情况有所不同,因为要上传的excel文件的内容需要明确提供。
对于ASP.NET Core应用程序,可以考虑以下解决方案:
PUT https://graph.microsoft.com/v1.0/me/drive/root:/sample.pptx:/content
示例)C#示例
POST https://graph.microsoft.com/v1.0/me/drive/root/children
{
"name": "Sample.pptx",
"file":{ }
}
其中
CreateWorkbook