这个问题通常由于无效的连接凭据或权限不足导致。请确保您使用的凭据是正确的,并且具有必要的权限来访问SharePoint Online资源。
在Power Automate中,您可以打开工作流设计器,并查看API连接的状态。 如果连接无效,请单击它并更新凭据。
在代码中,您可以检查连接的状态并更新凭据,如下所示:
// Update SharePoint Online connection credentials
var connection = new OpenApiConnection("sharepointonline");
connection.UpdateConnection(new ConnectionCredentials {
Username = "myusername",
Password = "mypassword"
});
// Check connection status
if (!connection.IsSuccessful) {
throw new Exception("Connection to SharePoint Online failed");
}
// Perform workflow action with SharePoint Online resource