locked
[C#] How can I check installed office is activated/Licensed or not? RRS feed

  • Question

  • Hi

    In my UWP app, I did a functionality which display office DOC/PPT into UWP app after converting it into images through console app (use bridge feature).

    Now I need to apply 2 checks in my UWP app.

    1. MS Office installed or not if yes, which version installed -  DONE

    2. If installed, is this MS Office activated/Licensed or not - LOOKING...

    So I need to work on #2. Please suggest for same.


    sandeep chauhan

    • Moved by Barry Wang Tuesday, May 28, 2019 8:20 AM detect office license in C# code
    Monday, May 27, 2019 1:46 PM

Answers

  • SOLUTION-

    I made a bat file by using this command and run it as an administrator using c# (ProcessStartInfo). and save command output into a txt file and found LICENSED keyword. If found set Activated otherwise not.

    please let me know if anybody face any issue for same.

    Thanks

    Sandeep


    sandeep chauhan

    Monday, August 19, 2019 1:32 PM

All replies

  • Hello sandeep chauhan,

    I'm afraid UWP by default haven't provide this API for you. 

    Regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 28, 2019 6:04 AM
  • Hi Barry

    Thanks for reply!

    Could we do it from console app (C#) we will call console through full trust.


    sandeep chauhan

    Tuesday, May 28, 2019 6:52 AM
  • @sandeep chauhan,

    I'm not so sure. I will move your case to office dev forum as that is a more appropriate forum for your issue. Hope you can get some direction there.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 28, 2019 8:20 AM
  • You have with Office a VBS named OSPP.vbs in C:\Program Files\Microsoft Office\Office16 (for 64 bits)

    Woth the command /dstatus this VBS display in console information about the licence and the activation of Office. You could probably run the VBS and read the output (or store the output) to use it after in C#


    Ce post à été écrit par un panda

    Tuesday, May 28, 2019 1:49 PM
  • Hi MarieKisSlaJoue

    I tried following command on cmd with opening Run As Administrator or without Administrator. Getting below response-  

    C:\Program Files\Microsoft Office\Office15>/dstatus
    '/dstatus' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Microsoft Office\Office16 is not recognized, Office15 is installed. 

    Thanks

    Sandeep


    sandeep chauhan


    Wednesday, May 29, 2019 2:28 PM
  • Hi MarieKisSlaJoue

    I tried and get License info into command prompt as manually changed the path of command prompt and type dstatus like below-

    C:\Program Files\Microsoft Office\Office15>/dstatus

    but how I do it programmatically and read the status into code in c#.

    Thanks

    Sandeep


    sandeep chauhan

    Thursday, June 27, 2019 12:44 PM
  • SOLUTION-

    I made a bat file by using this command and run it as an administrator using c# (ProcessStartInfo). and save command output into a txt file and found LICENSED keyword. If found set Activated otherwise not.

    please let me know if anybody face any issue for same.

    Thanks

    Sandeep


    sandeep chauhan

    Monday, August 19, 2019 1:32 PM