0
0

PowerAppsアプリでPDF化したファイルをSharePointリストに保存する方法

Posted at

PowerAppsアプリでPDF化したファイルをSharePointリストに保存する方法
以下のコードをボタンなどのOnSelectプロパティに記入

//↓sharepointサイトアドレス:https://●●●●●●●●.sharepoint.com/sites/●●●●●●
UpdateContext({_siteurl:"sharepointサイトアドレス"});

//↓保存するリストを表示したときのアドレスの▲▲▲▲▲▲部分。https://●●●●●●●●.sharepoint.com/sites/●●●●●●/Lists/▲▲▲▲▲▲/AllItems.aspx
UpdateContext({_listname:"PDFファイルを保存するリストの名前"});

UpdateContext({_openurl:Blank()});//ファイルのURL用変数を一度空にする

UpdateContext({_datetime:Text(Now(),"yymmddhhmmss")});//現在日時を文字列にする

UpdateContext({_pdfname:$"PDF化ファイル{_datetime}.pdf"});//PDFの名前を設定(日時を入れる)

UpdateContext({_pdfvalue:PDF(Gallery1)});//PDF関数を使ってGallery1をPDF化

UpdateContext(
{
_pdfsaveid:Last(
Collect(
PDFリスト,
{
タイトル:_pdfname,
添付ファイル:Table(
{
DisplayName: _pdfname,//ファイル名
Id:GUID(),//IDを取得。無いとエラーになります。
Value: _pdfvalue//中身
}
)
}
)
).ID
}
);

//保存したファイルのURLを作成 https://●●●●●●●●.sharepoint.com/sites/●●●●●●/Lists/▲▲▲▲▲▲/Attachments/●●/PDFファイル●●●●●●●●.pdf
UpdateContext({_openurl:$"{_siteurl}/Lists/{_listname}/Attachments/{_pdfsaveid}/{_pdfname}"});

//保存したファイルを開く
If(
!IsBlank(_openurl),Launch(_openurl & "?web=1")
)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0