| Previous | Next |
| STG_E_TOOMANYOPENFILES | STG_E_INVALIDHANDLE |
STG_E_ACCESSDENIED
Permission is only one possibility
STG_E_ACCESSDENIED says that Structured Storage could not perform the requested operation with the access available to the caller. File-system ACLs, a read-only share, a protected temporary directory, or a service account without rights are common causes. But this HRESULT should also be considered alongside the mode used to open the root storage and its child streams: permissions on a parent storage restrict what can be granted to its children.
This matters when an application opens a document successfully for reading and then later attempts to create a stream, update a property set, or commit a transaction. The failure is then about the attempted write, not necessarily about the ability to locate or parse the file.
How to narrow it down
- Log the identity, final path, requested access, and whether the operation is opening, creating, deleting, or committing a storage element.
- Check both the outer file and its containing directory; creating a replacement file often requires directory permissions too.
- Verify the
STGM_*mode selected for the root storage before diagnosing an ACL problem. - Do not “fix” the error by granting broad permissions; identify the minimal identity and access needed by the actual operation.
References
- Microsoft: IStorage::OpenStream
- Microsoft: IStorage::CreateStorage
- Apache POI: POIFS compound document support
Looking for a different code? Search another status or error code.
