Share via

System.Runtime.InteropServices.COMException: 'There was no match for the specified key in the index. (0x80070491)'

Indrajeet Singh 0 Reputation points
2023-06-21T04:39:45.84+00:00

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
Developer technologies | ASP.NET Core | Other
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.