Posts

Showing posts from 2016

Serialization File Error Could not load file or assembly mscorlib.XmlSerializers

When serializing an XML file, an error occurs in the following manner: XmlSerializer serializer= new XmlSerializer(typeof(MyType)); Errors such as : The assembly with display name 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. use the following line to solve it:  XmlSerializer lizer = XmlSerializer.FromTypes(new[] { typeof(MyType) })[0];

Error "The operation can not be performed Because the message Has Been changed"

Being of the email changes saved, then the execution of the mail Save () method, you may experience the error   "The operation can not be performed Because the message Has Been changed."  Especially if you go to edit multiple email. This is due to the object  Microsoft.Office.Interop.Outlook.UserProperty  that was not released.   So before the save is to be performed education System.Runtime.InteropServices.Marshal.ReleaseComObject (UserProperty). At this stage the previous post snippet becomes   public void AddCustomPropertyToMail (entryID string, string propertyName, string value) { Microsoft.Office.Interop.Outlook.MailItem mail = Globals.ThisAddIn.Application.Session.GetItemFromID (entryID) as Microsoft.Office.Interop.Outlook.MailItem; if (email! = Null) { Microsoft.Office.Interop.Outlook.UserProperty UserProperty = mail.UserProperties.Add (propertyName, Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText); UserProperty.Value = value; Syst

OCR text detection with google APIs C#

Image
After searching more than 3 hrs to know how to implement text detection using google API i decided to write this post, hope it help c# developer to know how to use and implement Vision API, Source Code :  https://github.com/msm2020/OCR-google-APIs 1- Create server key on google console Go to http://console.developers.google.com/ and create new project or use existing project From Overview page enable vision API You need to create new bill information to use vision API, it's fully free for 1st 1000 request/ month you can check https://cloud.google.com/vision/docs/pricing After Enable Google Cloud Vision API go to Credentials page and create new server key Create key by fill all requested data and download Json file 2- Create Visual studio project I'll use vs 2015 and .NET framework 4.5 Add google Nuget packages : Google.Apis.Vision.v1 by right click on project and then manage nuget