Skip to content

OneDrive/SharePoint — Close

Type: msfiles-close  ·  Package: OneDrive / SharePoint v1.0.5

Closes a OneDrive/SharePoint session and releases its resources. It is only needed when you opened the session with Connect without body.

It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter.

If you used Connect with body, the session closes automatically when the block ends and you do not need this activity.

Closing the session changes nothing in OneDrive or SharePoint: every earlier operation was applied when it happened. After closing, the session variable can no longer be used by other activities.

None.

ParameterTypeDefaultDescription
sessionZoanMicrosoftFilesSession—Connect session to close. Inherited inside Connect’s body.

This activity does not return a value.

MessageCause and fix
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically.You did not pass session and the activity is not inside Connect’s body. Pass the variable returned by Connect.

Apart from that case, the activity does not fail: it makes no calls to Microsoft 365.

OneDrive/SharePoint — Connect credential = credential("m365-operations") → output: session
OneDrive/SharePoint — Upload session = session path = "C:\reports\today.pdf" destination = "Reports/today.pdf"
OneDrive/SharePoint — Close session = session

To close the session even if an activity in between fails, put Close in the finally of a Try / Catch, or use Connect with body, which does it for you.