Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

FREE Microsoft eBooks

Largest collection of FREE Microsoft eBooks ever, including: Windows 8.1, Windows 8, Windows 7, Office 2013, Office 365, Office 2010, SharePoint 2013, Dynamics CRM, PowerShell, Exchange Server, Lync 2013, System Center, Azure, Cloud, SQL Server, and much m

Microsoft Senior Sales Excellence Manager – Eric Ligman

July 10, 2014 Posted by | Uncategorized | Leave a comment

Win API (HWND) integration in Outlook is not a supported platform technology.

How to add a window that is adjacent to the preview pane in Outlook  - http://support.microsoft.com/kb/982758

June 18, 2014 Posted by | Uncategorized | Leave a comment

Support guidelines for client-side messaging development – KB266353

Why Win32 API is not supported http://support.microsoft.com/kb/266353

June 14, 2014 Posted by | Outlook, Uncategorized | Leave a comment

Exchange 2010 does not support WebDAV ( discontinued)

Exchange 2007 was the last version of Exchange to support using WebDAV.

Developer roadmap for Exchange ( search for WebDAV)

http://msdn.microsoft.com/en-us/library/dd877025.aspx

Discontinued Features
http://technet.microsoft.com/en-us/library/aa998911(v=exchg.141).aspx

What may work for you is to use Exchange Web Serveries (EWS), which overall has superior calendaring abilities.  There is a .NET API called the EWS Managed API which wraps EWS calls and should make using EWS a lot easier.

Differences between the EWS Managed API and EWS

http://msdn.microsoft.com/en-us/library/office/dd633678(v=exchg.80).aspx

EWS Managed API reference

http://msdn.microsoft.com/en-us/library/office/jj220535(v=exchg.80).aspx

Microsoft Exchange Web Services Managed API 2.2

http://www.microsoft.com/en-us/download/details.aspx?id=42951

Explore the EWS Managed API 2.0

http://msdn.microsoft.com/en-us/library/office/dd633710(v=exchg.80).aspx

 

June 12, 2014 Posted by | Office, Outlook | Leave a comment

Office update center- build number and SP’s details + Open XML SDK 2.5

Open XML SDK 2.5 for Microsoft Office

http://www.microsoft.com/en-in/download/details.aspx?id=30425

Update center for Office, Office servers, and related products

http://technet.microsoft.com/en-us/office/ee748587.aspx

June 12, 2014 Posted by | Outlook | Leave a comment

Microsoft Office Configuration Analyzer Tool 1.2

The Office Configuration Analyzer Tool 1.2 (OffCAT ) provides a quick and easy method to analyze most Microsoft Office programs for common configurations that may cause problems. *Download only OffCAT.msi if you want to install OffCAT. Review the ReadMe file to see if the other files are needed.

http://www.microsoft.com/en-us/download/details.aspx?id=36852

Supported Operating System

Windows 7, Windows 8, Windows Vista Service Pack 2, Windows XP Service Pack 3
This download works with the following Microsoft Office products:

• Microsoft Office 2013 (32-bit or 64-bit, Click-to-run or Msi installs)
• Microsoft Office 2010 (32-bit or 64-bit)
• Microsoft Office 2007
OffCAT version 1.2 provides scanning for the following Office programs:

•Microsoft Access
•Microsoft Excel
•Microsoft InfoPath
•Microsoft OneNote
•Microsoft Outlook
•Microsoft PowerPoint
•Microsoft Publisher
•Microsoft Visio
•Microsoft Word
The following minimum version of the Microsoft .NET Framework is required:
• Microsoft .NET Framework Version 2.0
The following Microsoft Office feature is also required:
• .NET Programmability Support

June 11, 2014 Posted by | Office | | Leave a comment

Exchange Sp details, support life cycle, EWS Java API – Links

EWS Java API 1.2 – get started!
http://blogs.msdn.com/b/exchangedev/archive/2013/01/03/ews-java-api-1-2-get-started.aspx

Exchange: EWS Java API 1.2
http://code.msdn.microsoft.com/Exchange-EWS-Java-API-12-1a5a1143/view/Discussions#content

Supportability of Microsoft EWS Java API 1.1 for Exchange Server 2007/2010 – Brij Blog
http://blogs.msdn.com/b/brijs/archive/2012/04/24/fyi-supportability-of-microsoft-ews-java-api-1-1-for-exchange-server-2007-2010.aspx

Exchange Server and Update Rollups Build Numbers
http://social.technet.microsoft.com/wiki/contents/articles/240.exchange-server-and-update-rollups-build-numbers.aspx

Microsoft Support Lifecycle
http://support.microsoft.com/lifecycle/default.aspx

June 10, 2014 Posted by | Exchange EWS | Leave a comment

Procdump is preferred over Adplus- About ProcDump.

There may be many ways to capture the dumps in winodws, but which one gives us the better dumps ? Obviously Procdump has lot of advantage, details and preferred over Adplus when see the details in Windbg. 

We suggest to use Procdump and also carefully select the bitness when capturing dumps. For 64 bit use -64 or else leave it blank(default it is 32 bit).

 The syntax goes like this for crash-> Procdump -e -ma -t -64 -w Outlook.exe    (Procdump page has got details about these command line switches)

Let me put it in steps,

1)    Before taking dump, enable page heap corruption checking using the following command:   gflags.exe -p /enable outlook.exe /full

 2)    Now run the procdump command to capture the dump with bitness set accordingly. Procdump -e -ma -t -64 -w Outlook.exe  Wait for the crash and confirm dump has been created successfully.

 3)    After the crash, reset command: gflags.exe -p /disable outlook.exe You can use the following command line to see if page heap checking is enabled:    gflags.exe –p

 For additional info, refer Dan B blog post here and about procdump quick video here.

June 6, 2014 Posted by | Uncategorized | | Leave a comment

Why Office server side automation is not supported, EWS Links, Open XML starter pack

1)      Considerations for server-side Automation of Office – http://support.microsoft.com/kb/257757/en-us

 2)      EWS API links – Below are some starter links. 

 Exchange for developers – http://msdn.microsoft.com/en-us/office/dn448484

 Developer roadmap for Exchange – http://msdn.microsoft.com//library/office/dd877025(v=exchg.150)

 Get started with EWS Managed API client applications -http://msdn.microsoft.com/en-us/library/office/jj220499(v=exchg.80).aspx

 EWS Managed API concepts – http://msdn.microsoft.com/en-us/library/office/dd633649(v=exchg.80).aspx  

 Working with the EWS Managed API – http://msdn.microsoft.com/en-us/library/office/dd633696(v=exchg.80).aspx

 Microsoft Exchange Web Services Managed API 2.1  - http://www.microsoft.com/en-us/download/details.aspx?id=42022

 C# Sample code:

        //pass the credential and EWS asmx detail

       privateint GetUnreadCount()

        {

            ExchangeService service = newExchangeService(ExchangeVersion.Exchange2013);

            service.Url = newUri(“https://yourcasserver/ews/exchange.asmx“);

            service.Credentials = newWebCredentials(“Username”, “Password”);

 

            Folder inbox = Folder.Bind(service, WellKnownFolderName.Root);

            SearchFilter sf = newSearchFilter.SearchFilterCollection(LogicalOperator.And, newSearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));

            ItemView view = newItemView(50);

            view.Traversal = ItemTraversal.Shallow;

            FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sf, view);

            //get the count

            int count = findResults.Count();

            return count;

        }

3)      For Open XML, http://www.microsoft.com/en-us/download/details.aspx?id=17985

By default, this download installs files to the following locations:

i. Visual C# snippets. PersonalFolder\Visual Studio 2010\Code Snippets\Visual C#\Open XML SDK 2.0 for Microsoft Office 2010

ii.  Visual Basic snippets. PersonalFolder\Visual Studio 2010\Code Snippets\Visual Basic\Open XML SDK 2.0 for Microsoft Office 2010

Generating Excel 2010 Workbooks by using the Open XML SDK 2.0  

http://msdn.microsoft.com/en-us/library/hh180830(v=office.14).aspx

4)      Regarding EWS Editor – http://ewseditor.codeplex.com/

May 29, 2014 Posted by | Uncategorized | Leave a comment

How to convert word document to PDF using MS PIA Interop libraries.

For Word interop ref: c:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Word.dll

using System;

using System.Reflection;

using Word = Microsoft.Office.Interop.Word;

namespace ConsoleApplication5

{

classProgram

{

staticvoid Main(string[] args)

{

Application app = new Word.Application();

Missing ms = Missing.Value;

Document doc = app.Documents.Open(“D:\\Inputlog.doc”, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms);

doc.ExportAsFixedFormat(“D:\\dave_sample.pdf”, Word.WdExportFormat.wdExportFormatPDF, false, Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Word.WdExportRange.wdExportAllDocument, 1, 1, Word.WdExportItem.wdExportDocumentContent, false, true, Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, false, true, false);

}

}

May 15, 2014 Posted by | Uncategorized | | Leave a comment

How to use the Outlook object model to retrieve all recurring appointments

You have to set ‘oItems.IncludeRecurrences = True’ if you are trying to get all the recurring calendar items in VBA-Outlook.

http://support.microsoft.com/kb/201101/en-us

http://blogs.msdn.com/b/waltwa/archive/2007/03/14/finding-appointments-within-a-specific-timeframe.aspx

April 30, 2014 Posted by | Uncategorized | Leave a comment

How to use the same keyset for strongname signing as well as for manifest and/or Authenticode signing.

Strong name signing requires KeySpec=2 (AT_SIGNATURE). Similar issue was blogged for VS2005  http://blogs.msdn.com/b/andrekl/archive/2008/01/08/strong-name-signing-in-visual-studio-2005-requires-keyspec-2-at-signature.aspx and that still holds true for VS2010. The certificate has KeySpec=1 (AT_EXCHNAGE) and worked around by modifying the certificate to have KeySpeck=1. Steps below helps you to successfully sign the project

1. Using the “Certifiates” MMC export the existing keyset (KeySpec=1) to a PFX file.

2. Delete the existing certificate from the crypto store (using the MMC).

3. Open a CMD prompt.

4. import the PFX file using this command:certutil -importPFX -user <pfxfilename> AT_SIGNATURE

5. Enter the passphrase for the pfx when prompted.

6. You now should have a keyset/Cert with KeySpec=2. If needed you can now export this into another PFX file using the MMC again.

7. Use the new .pfx in the Visual Studio to sign the executable

April 30, 2014 Posted by | Uncategorized | , , | Leave a comment

Profman2.exe – MAPI Profile Manager v2.0

Profman2.exe is a self-extracting achieve that contains a sample program demonstrating how to use the MAPI interfaces and methods that pertain to the manipulation and creation of MAPI profiles.

Here is a list of its functionality:

  • Create a new blank profile.
  • Add services to a profile.
  • Delete services from a profile.
  • List the services in a profile.
  • Add providers to a service.
  • Delete providers from a service.
  • List the providers in a service.
  • List the available properties of a service (even ones that are normally inaccessible).
  • List the available properties of a provider (even ones that are normally inaccessible).
  • Outlook 2000 Compliant (reads proper location of MAPISVC.inf file)

download @ http://support.microsoft.com/kb/228736

April 18, 2014 Posted by | Uncategorized | | Leave a comment

From training-links for later reading { O365 apps, Office PIA, XL, VSTO }

O365 web apps development
1) The Office 365 platform —new opportunities for developers
http://blogs.office.com/2014/03/03/create-apps-for-office-365/

2) Here is a Video of the possibilities :
http://www.youtube.com/watch?v=qryRH5xXyJk&feature=player_embedded

3) MSDN article we might need to be aware of -Office 365 APIs Preview
http://msdn.microsoft.com/en-us/library/office/dn605892.aspx

4) How to: Add Office 365 APIs to a Visual Studio project
http://msdn.microsoft.com/en-us/library/office/dn605899.aspx

UDF
5) What is UDF – http://blogs.msdn.com/b/frice/archive/2004/06/11/153891.aspx

6) UDF using .NET – http://blogs.msdn.com/b/eric_carter/archive/2004/12/01/writing-user-defined-functions-for-excel-in-net.aspx

7) http://msdn.microsoft.com/en-us/library/ms173189(v=vs.80).aspx

8) Automation Add-ins section – http://support.microsoft.com/kb/291392

XLL
9) What is XLL – An XLL is an add-in for Microsoft Excel that you can build with any compiler that supports building DLLs (dynamic link libraries).
10) Download XLL SDK from – http://go.microsoft.com/fwlink/?LinkID=251082&clcid=0×409

11) http://blogs.msdn.com/b/andreww/archive/2007/12/09/building-an-excel-xll-in-c-c-with-vs-2008.aspx

12) http://msdn.microsoft.com/en-us/library/office/bb687861(v=office.15).aspx

13) http://support.microsoft.com/kb/178474

 

Excel
14) Understanding the Excel Object Model from a .NET Developer’s Perspective
http://msdn.microsoft.com/en-us/library/office/aa168292(v=office.11).aspx

15) How to automate Microsoft Excel from Microsoft Visual C#.NET
http://support.microsoft.com/kb/302084

16) How to transfer data to an Excel workbook by using Visual Basic .NET
http://support.microsoft.com/kb/306022

17) How to automate Excel from Visual Basic .NET to fill or to obtain data in a range by using arrays
http://support.microsoft.com/kb/302094

 

Office PIA
18) http://msdn.microsoft.com/en-us/library/15s06t57(v=vs.110).aspx

19) Primary Interop Assemblies Concept – http://msdn.microsoft.com/en-us/library/aax7sdch.aspx

20) http://msdn.microsoft.com/en-us/library/aa302338.aspx

21) Better eventing support in CLR 4.0 using NOPIA support
http://blogs.msdn.com/b/mshneer/archive/2008/10/28/better-eventing-support-in-clr-4-0-using-nopia-support.aspx

22) How to: Install Office Primary Interop Assemblies – http://msdn.microsoft.com/en-us/library/kh3965hw(v=VS.90).aspx

 

VSTO

23) Adding custom task pane
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3316853c-4cec-4cf5-8cf7-5fe6f3cd1bfe/adding-custom-task-pane?forum=vsto

24) How to: Attach Managed Code Extensions to Documents (2007 System)
http://msdn.microsoft.com/en-us/library/bb772091(v=vs.90).aspx

25) Memory leak (When you automate a Off app from .NET, the Office application does not quit when you call the Quit method)
http://support.microsoft.com/kb/317109

April 18, 2014 Posted by | Uncategorized | | Leave a comment

Office server side automation is not supported- famous KB 257757

There is no surprise still developers tend to code some kind of office automation on server without knowing that is not supported by us.
Recently I have seen a case where the developer is creating an excel pivot charts in server(automation) using SQL Server, DTS along with some programming with C#.net. It was working for him but all sudden it broke after migrating to latest server OS.
Here is the famous KB article which we keep sharing with dev’s and also famously referred in MS as “2 5 7 7 5 7″ which talks about why this is not supported. More at; 257757 KB here – http://support.microsoft.com/kb/257757

 

April 17, 2014 Posted by | Uncategorized | | Leave a comment

How to use EWS API for reading SMIME email message

What is SMIMEhttp://technet.microsoft.com/en-us/library/aa995740(v=exchg.65).aspx 

class Program
{
static ExchangeService exService;

static void Main(string[] args)
{
try
{
exService = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
exService.UseDefaultCredentials = true;
exService.AutodiscoverUrl(“user@Contoso.com”, RedirectionCallback);

Console.WriteLine(“Connected(Autodiscovered EWS Endpoint)- ” + exService.Url);

//find the trace log dumped in debug\log.txt
exService.TraceEnabled = true;
exService.TraceListener = new TraceListener();
exService.TraceEnablePrettyPrinting = true;

Console.WriteLine(“Getting inbox items..”);
byte[] data = GetInboxMailItems();

if (data == null)
{
Console.WriteLine(“No Mails retreived “);
Console.ReadKey();
return;
}
//
byte[] resultObject= DecryptToFile(data);

if(resultObject==null)
{
Console.WriteLine(“No object retrieved from Decrypt. somthing wrong in this method”);

}
else
{
string uniqueFname = Path.GetRandomFileName()+”.eml”;
Console.WriteLine(@”Decrypted EML file dumped here — c:\temp\” + uniqueFname);

//Find the decrypted file here
//Load this file in Outlook for testing.
File.WriteAllBytes(@”c:\temp\” + uniqueFname, resultObject);
}

//write the decrypted content to a file – mail item .eml
Console.WriteLine(“Press any key to exit..”);
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine(“Error while initializing..” + ex.ToString());
}
}

/// <summary>
///
/// </summary>
private static byte[] GetInboxMailItems()
{
byte[] data = null;

//Get inbox unread mails (have a mail ready for decrypt which is signed & decrypt)
Folder inbox = Folder.Bind(exService, WellKnownFolderName.Inbox);
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));

ItemView view = new ItemView(1);

FindItemsResults<Item> findResults = exService.FindItems(WellKnownFolderName.Inbox, sf, view);

//Have atleast 1 unread ‘encrypted,signed’ mail for this testing
if (findResults.TotalCount == 0)
{
return data;
Console.WriteLine(“No Mails retreived”);
}

//Loop through the items and do whatever is required.
foreach (Item item in findResults)
{
//Load the mail item
PropertySet ps = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Attachments);
item.Load(ps);

foreach (Microsoft.Exchange.WebServices.Data.Attachment attach in item.Attachments)
{
// find the encrypted mails attachment- in general body and any mail content for encrypted mail would be bundled as smime.p7m file in mailstore
if (attach.Name == “smime.p7m”)
{
Console.WriteLine(“Process smime.p7m file”);
FileAttachment fileAttachment = (FileAttachment)attach;
MemoryStream stream = new MemoryStream();
fileAttachment.Load(stream);
StreamReader stReader = new StreamReader(stream);
stream.Seek(0, SeekOrigin.Begin);
data = stream.GetBuffer();

return data;
}
}
}
return data;
}

/// <summary>
///
/// </summary>
/// <param name=”data”></param>
private static byte[] DecryptToFile(byte[] data)
{
byte[] resultObject = null;

try
{
EnvelopedCms envelopObj = new EnvelopedCms();
envelopObj.Decode(data);

Console.WriteLine(“Encryption Algorithm: Name={0}”, envelopObj.ContentEncryptionAlgorithm.Oid.FriendlyName);
Console.WriteLine(“Key length={0}”, envelopObj.ContentEncryptionAlgorithm.KeyLength);
Console.WriteLine(“Recipients ({0})”, envelopObj.RecipientInfos.Count);

foreach (RecipientInfo r in envelopObj.RecipientInfos)
{
Console.WriteLine(” Encrypted key={0}”, BitConverter.ToString(r.EncryptedKey));
Console.WriteLine(” Encryption alg={0}”, r.KeyEncryptionAlgorithm.Oid.FriendlyName);

if (r.RecipientIdentifier.Type == SubjectIdentifierType.IssuerAndSerialNumber)
{
X509IssuerSerial xi = (X509IssuerSerial)r.RecipientIdentifier.Value;
Console.WriteLine(” Issuer={0}”, xi.IssuerName);
Console.WriteLine(” SerialNumber={0}”, xi.SerialNumber);
}
else
{
Console.WriteLine(” SubjectKeyInfo={0}”, r.RecipientIdentifier.Value);
}
}

Console.WriteLine(“Certificates ({0})”, envelopObj.Certificates.Count);

foreach (X509Certificate2 cert in envelopObj.Certificates)
{
Console.WriteLine(“Subject={0}”, cert.SubjectName);
}

Console.WriteLine(“Unprotected Attributes ({0})”, envelopObj.UnprotectedAttributes.Count);

foreach (CryptographicAttributeObject obj in envelopObj.UnprotectedAttributes)
{
Console.WriteLine(obj.Oid.FriendlyName);
}

envelopObj.Decrypt();
Console.WriteLine(“Success. Decrypted… !!”);
resultObject = envelopObj.ContentInfo.Content;

return resultObject; ;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return resultObject;
}

/// <summary>
///
/// </summary>
/// <param name=”url”></param>
/// <returns></returns>
static bool RedirectionCallback(string url)
{
// Return true if the URL is an HTTPS URL.
return url.ToLower().StartsWith(“https://&#8221;);
}
}

/// <summary>
///
/// </summary>
public class TraceListener : ITraceListener
{
#region ITraceListener Members

public void Trace(string traceType, string traceMessage)
{
CreateXMLTextFile(traceType + ” — ” + traceMessage.ToString());
}

#endregion

private void CreateXMLTextFile(string traceContent)
{
string strPath = System.AppDomain.CurrentDomain.BaseDirectory;
strPath = strPath + “\\Log.txt”;
System.IO.FileStream fs;
if (System.IO.File.Exists(strPath) == false)
{
fs = System.IO.File.Create(strPath);
}
else
{
fs = System.IO.File.OpenWrite(strPath);
}

fs.Close();

// Create an instance of StreamWriter to write text to a file.
System.IO.StreamWriter sw = System.IO.File.AppendText(strPath);
sw.WriteLine(System.DateTime.Now.ToString() + “: ” + traceContent);
sw.Close();

}
}

April 15, 2014 Posted by | Uncategorized | , , | Leave a comment

How to convert Hex to Base64 in C#

Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.

Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that is designed to deal with textual data. This is to ensure that the data remains intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, and storing complex data in XML.

//Convert Hex to Base64
static void Main(string[] args)
{
string hexstr = “040000008200E00074C5B7101A82E0080000000622029301EB4592B71528F44A48D7″;
byte[] data = ConvertFromStringToHex(hexstr);
string base64 = Convert.ToBase64String(data);

Console.WriteLine(base64);
}

public static byte[] ConvertFromStringToHex(string inputHex)
{
inputHex = inputHex.Replace(“-”, “”);

byte[] resultantArray = new byte[inputHex.Length / 2];
for (int i = 0; i < resultantArray.Length; i++)
{
resultantArray[i] = Convert.ToByte(inputHex.Substring(i * 2, 2), 16);
}
return resultantArray;
}

April 15, 2014 Posted by | Uncategorized | | Leave a comment

Follow

Get every new post delivered to your Inbox.