пятница, 2 марта 2018 г.

Outlook 2016 Moving a data file to another disk

Situation

On a laptop with the first small SSD drive, I want to move the outlook data file to another large disk (to free up more space on the SSD)


Task

Transfer the Outlook 2016 data file to another drive (in general, to another location)


What did not work?

a rough move of the file and the restart of Outlook did not help. Outlook 2016 recreates its file in the old location.


What worked

solution for Windows 10


Creating a symbolic link


Steps:


1. Close Outlook

2. Move the .ost data file (it is usually stored C: \ Users \ (user) \ AppData \ Local \ Microsoft \ Outlook \).

3. Make a symbolic link



mklink "C: \ Users \ (user) \ AppData \ Local \ Microsoft \ Outlook \ (filename) .ost" "D: \ Outlook \ (filename) .ost"



Do not forget to replace

(user) and (filename) to real values



Related links

Moving the ost-file or pst-file of an Outlook.com or IMAP account
(this is about the creation of symbolic links)
https://www.howto-outlook.com/howto/movingostpstoutlookcomimap.htm




Move the ost-file to another disk or folder location
https://www.msoutlook.info/question/463
here it is said that for the Outlook 2016 the file transfer method does not work

Google Cloud Translation API C# code sample

A simple example of implementing the Google Cloud Translation API for C #


Google.Cloud.Translation.V2 library must be installed into the project through the NuGet


public class TranslateServiceGoogle
    {
        public int MaxTextLenght => 4999;

        private readonly string apiKey;

        private TranslationClient _client;
        private TranslationClient Client => _client ?? (_client = TranslationClient.CreateFromApiKey(apiKey));

        public TranslateServiceGoogle(string apiKey)
        {
            this.apiKey = apiKey;
        }        

        public string TranslateText(
            string text,
            string languageFrom,
            string languageTo
            )
        {
            if (string.IsNullOrWhiteSpace(text)) return "";

            CheckTranslatebleText(text);                      

            var res = Client.TranslateText(text, languageTo, languageFrom);

            return res.TranslatedText;
        }

        public string TranslateHtml(
            string text,
            string languageFrom,
            string languageTo
        )
        {
            if (string.IsNullOrWhiteSpace(text))
                return "";

            CheckTranslatebleText(text);
            
            var response = Client.TranslateHtml(text, languageTo, languageFrom);

            return response.TranslatedText;
        }

        public void CheckTranslatebleText(string text)
        {
            if (text.Length > MaxTextLenght)
            {
                throw new ArgumentOutOfRangeException($"Text length exceeds ({text.Length} symbols)!");
            }
        }
    }