I have created dotnet application which is updating metadata (e.g. "Title" property) of XLSX file.
I am using Microsoft.WindowsAPICodePack.Shell
library in my application...which is perfectly updating metadata of that file on development environment.
But on production server that application is not working.
It is giving error like.....
Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemException (0x80004005): Unable to get writable property store for this property.
Development and Production environment is having same OS installed. Visual Studio and office installed on delvelopment environment. But not on production environment.
Does any one have idea on this?
Add following NuGet packages to your project:
Microsoft.WindowsAPICodePack-Shell
by MicrosoftMicrosoft.WindowsAPICodePack-Core
by Microsoftusing Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
string filePath = @"yourfilepath";
var file = ShellFile.FromFilePath(filePath);
// Read and Write:
string[] oldAuthors = file.Properties.System.Author.Value;
string oldTitle = file.Properties.System.Title.Value;
file.Properties.System.Author.Value = new string[] { "Author #1", "Author #2" };
file.Properties.System.Title.Value = "Example Title";
// Alternate way to Write:
ShellPropertyWriter propertyWriter = file.Properties.GetPropertyWriter();
propertyWriter.WriteProperty(SystemProperties.System.Author, new string[] { "Author" });
propertyWriter.Close();
User contributions licensed under CC BY-SA 3.0