Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
System.Runtime.InteropServices.COMException: 'There was no match for the specified key in the index. (0x80070491)'
Hi Team,
Am trying to add permissions on an excel file from .net core 6. Am using Microsoft.Interop.Excel and Microsoft.Office.Core libraries. On debugging i got to know the error is in line
workbook.Permission.Add('******@domain.com',MsoPermission.msoPermissionRead, new DateTime(2025, 12, 31))
Note: Same code is working for few machines but for few its giving this error.
can anyone help me to get an idea, what can be the probable issues. I have checked for few possibilities but didn't got anything concrete:
- Checked for Office Version : Same for both machines
- Checked for .Net version : Same for both machines
- Checked for Access Level : Used admin access in machines having issue
Can you provide some pointers what else can be the reason?
Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Developer technologies | ASP.NET Core | Other
A set of technologies in .NET for building web applications and web services. Miscellaneous topics that do not fit into specific categories.