Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work when ran with scheduled tasks #323

Closed
glautrou opened this issue Jun 11, 2021 · 2 comments
Closed

Does not work when ran with scheduled tasks #323

glautrou opened this issue Jun 11, 2021 · 2 comments

Comments

@glautrou
Copy link

glautrou commented Jun 11, 2021

Hi,

When I execute my program with a Windows Scheduled Task the method Open() returns null.

using (var word = new Word.Application())
{ 
    if (!File.Exists(wordFile.FullName)) // => file exists
        throw new FileNotFoundException(wordFile.FullName);

    var document = word.Documents.Open(wordFile.FullName); // => document is null
    if (document == null)
        throw new Exception($"Document null : {wordFile.FullName}"); // => Exception here
}

I my scheduled task running under the administrator account I checked :

  • "Execute even if user is not connected"
  • "Execute with maximal authorisations"

It only works if the administrator account is logged in, which is not possible to keep on a server, especially after a reboot.
Is it possible to work without active user session?

Thanks for your help.

Note : I am currently using the latest NuGet package : NetOffice.Word 1.7.4.11.

@glautrou glautrou changed the title Word.Documents.Open() null on Word 2019 Does not work when ran with scheduled tasks Jun 11, 2021
@jozefizso
Copy link
Member

For questions about system integration and/or implementation for specific use case please post your question to https://stackoverflow.com/ with tag [netoffice]

@jozefizso
Copy link
Member

jozefizso commented Jun 12, 2021

PS: our official and digitally signed package is NetOfficeFw.Word, latest release 1.8. (see #276)

The package you are using is a rogue one and it does not work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants