咨询:能否通过Microsoft Graph API创建OneDrive文件夹密码保护链接
Hey Rhyd,
Unfortunately, the Microsoft Graph API's DriveItem CreateLink operation doesn't support directly setting a password for shared links right now.
Even though you can create password-protected links through the OneDrive web interface or desktop client, this specific security control hasn't been exposed via the Graph API endpoints yet. As you noticed, the official documentation for CreateLink doesn't include any parameters related to password settings—this is a deliberate limitation at the moment.
Workarounds to Consider:
- Use the OneDrive PowerShell Module: Tools like
New-PnPOneDriveSecureLinklet you create password-protected shared links programmatically. This requires setting up the PowerShell environment and having appropriate permissions (like Site Collection Administrator or equivalent). - Check the Beta Graph API (Use with Caution): Occasionally, beta endpoints may preview upcoming features, but they're not intended for production use. As of now, even the beta version of
CreateLinkdoesn't offer a documented way to set a password for links.
If this functionality is critical for your use case, I'd recommend submitting a feature request through Microsoft's feedback portal—user input helps prioritize which API capabilities get added next.
内容的提问来源于stack exchange,提问作者Rhydian Coombs

