I have an Intranet Application where a .docm template downloaded from a ReactJS UI as a blob is opening in Protected View on the users’ machines. This is happening when downloading in browsers other than IE or Edge browser in IE mode.
When you download the document from Chrome or other browsers, MS Word is considering it as an Internet Application. Hence, the checkbox for Protected View is applying these changes and downloading it in Protected View.
The code to download this as a blob is in ReactJS is available here.
You’ll need to open Command Prompt in Admin mode to make the changes especially when User Account Control (UAC) is enabled on your Windows 10 machine. CD to system32 for 64-bit registration and SysWoW64 for 32-bit registration. Place the COM component in the folder from you want to register and also your executable is placed e.g. “C:\TFS\Code\bin\” in the example below.
To register use the below command:
To unregister use the below command:
regsvr32 /u "C:\TFS\Code\bin\MailObj.dll"
You should get a prompt that the register/unregister command succeeded. This command can be used to register/unregister DLL or OCX files.
Robocopy is a robust file copy command for the Windows command line. It allows users to copy files, directories, and even drives from one location to another. It can be automated with Task Scheduler to run at specific times.
Robocopy example to copy a file from Source to Destination:
Robocopy [Src] [Dest] [filename] [options]
Src: Can be local or UNC path
Dest: Can be local or UNC path
Code Sample batch file:
echo Sync Started
Robocopy C:\Data\TestFolder C:\Data\Logs\TestFolder\%DTVARYEAR%-%DTVARMONTH%-%DTVARDATE%_TestFolder testlogfile.log /FFT /Z /XA:H /LOG+:C:\Data\SchedTasks\LogsTest\%DTVARYEAR%-%DTVARMONTH%_AppLogs.txt
echo Log synced
The above code will copy the testlogfile.log from Source to Destination.
Options: /FFT Assumes FAT file times (two-second precision). /Z Copies files in restartable mode. /XA:H exclude hidden file /LOG+ log output to file and append.
Additional useful options: /MIR Mirrors a directory tree (equivalent to /e plus /purge). /XF exclude specified file /XD exclude specified directory
Suppose you need to hide the password in your clear text connection strings at a particular back-up path or any other path in config files. This can be achieved using PowerShell with the following code.
Today, one of the users of my application wanted to know if we can find out the original title of a ticket created in the Application. Although, we do not store any such logs for modifications, while on the verge of giving up, I remembered we archive the e-mails received by the Windows Service application that processes the e-mails and archives them at a location on the Server on which it is installed. The e-mail Subject line is stored as the ticket title. These tickets which are created by the Windows Service can be viewed in the Web Application.
Since the folder with the archiving e-mails have a lot of ’em, simply doing a Windows Search is a time killer! So I remembered my way through the good old DOS commands.
Since the .eml file has the ticket number, I used the dir command to search for the e-mail name and copy command to copy it to another location quickly.
Firstly cd to the location where the archived e-mails are stored on the Server:
So e.g. if the ticket number is 123456
dir *123456* /s
The /s searches for the File name inside the two wildcard characters asterisk “*” with the dir command.
Then if the file name is e.g. TICKET123456 – abc.eml then use copy command as follows within the same directory:
copy "TICKET123456 - abc.eml" c:\Temp
So, with the e-mail having the original Subject Line preserved, I could share the original ticket title.