Beispiel: Verwenden von CRM für Outlook-Methoden
Veröffentlicht: November 2016
Gilt für: Dynamics CRM 2015
Dieser Beispielcode ist für Microsoft Dynamics CRM 2015 und Microsoft Dynamics CRM Online 2015-Update.Laden Sie das Microsoft Dynamics CRM SDK-Paket herunter. Dieser ist an folgender Position im SDK-Downloadpaket verfügbar:
SampleCode\CS\Client\Outlook\UseOutlookSdk.cs
Anforderungen
Weitere Informationen zu den Anforderungen zum Ausführen des in diesem SDK enthaltenen Beispielcodes finden Sie unter Verwenden des Beispiel- und Hilfscode.
Demonstriert
Dieses Beispiel zeigt, wie die Methoden in der Microsoft.Crm.Outlook.Sdk.dll-Assembly verwendet werden.
Beispiel
// Set up the CRM Service.
CrmOutlookService outlookService = new CrmOutlookService();
// Determine if the Outlook client is running
if (outlookService.IsCrmClientLoaded)
{
if (outlookService.IsCrmDesktopClient)
{
// The desktop client cannot go offline
Console.WriteLine("CRM Client Desktop URL: " +
outlookService.ServerUri.AbsoluteUri);
Console.WriteLine("CRM Client state: " +
outlookService.State.ToString());
}
else
{
// See if laptop client is offline
if (outlookService.IsCrmClientOffline)
{
Console.WriteLine("CRM Client Offline URL: " +
outlookService.ServerUri.AbsoluteUri);
Console.WriteLine("CRM Client state: " +
outlookService.State.ToString());
// Take client online
// NOTE: GoOnline() will automatically Sync up with CRM
// database, no need to call Sync() manually
Console.WriteLine("Going Online...");
outlookService.GoOnline();
Console.WriteLine("CRM Client state: " +
outlookService.State.ToString());
}
else
{
Console.WriteLine("CRM Client Online URL: " +
outlookService.ServerUri.AbsoluteUri);
Console.WriteLine("CRM Client state: " +
outlookService.State.ToString());
// Take client offline
// NOTE: GoOffline triggers a synchronization of the
// offline database with the online server.
// If a sync is not required, you can use SetOffline().
Console.WriteLine("Going Offline...");
outlookService.GoOffline();
Console.WriteLine("CRM Client state: " +
outlookService.State.ToString());
}
}
}
Siehe auch
CrmOutlookService
GoOnline
GoOffline
Erweitern von Microsoft Dynamics CRM 2015 für Outlook
Schreiben von benutzerdefiniertem Code für Microsoft Dynamics CRM 2015 für Outlook
© 2017 Microsoft. Alle Rechte vorbehalten. Copyright