Symbian3/SDK/Source/GUID-335A4B77-20C4-52B9-88AA-58540269E321.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-335A4B77-20C4-52B9-88AA-58540269E321"><title>Connecting to the Calendar Server</title><prolog><metadata><keywords/></metadata></prolog><conbody> <p>A client can connect to the Calendar server using an already existing <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession</apiname></xref>. The <codeph>CCalSession</codeph> objects can then share the same connection to the server. </p> <p>You must create a session with the Calendar Server using <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession::NewL()</apiname></xref> before accessing a calendar entry. This provides a handle to the calendar file and connects you to the Calendar Server. </p> <codeblock id="GUID-6C04BAD1-2E03-5BFB-AEAF-85570C9394D1" xml:space="preserve">// Create a session with the Calendar Server from an existing session
CCalSession* CCalSession::NewL(CCalSession&amp; aSessionShared);</codeblock> <p>You use the same session handle to create other Calendar API objects, such as entry view, category, data exchange, iterator and observers. </p> <p>The Calendar Server object lets you perform the following functions: </p> <ul><li id="GUID-7B4FBAE5-BD22-58CA-AAFB-6C8C52FC6C08"><p>create a file using <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession::CreateCalFileL()</apiname></xref>. </p> <codeblock id="GUID-2FADACC5-87FA-54EA-8270-86F877A398BB" xml:space="preserve">_LIT(KFileName,"D:\\MyCalFile");
session-&gt;CreateCalFileL(KFileName); //pass the descriptor which hold the filename D:\MyCalFile</codeblock> <p> <b>Note:</b> If <filepath>D:\MyCalFile</filepath> already exists, then the function leaves. </p> </li> <li id="GUID-1D65EDDA-DF1F-5BC0-914D-7473175E4183"><p>open a file using <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession::OpenL()</apiname></xref>. </p> <codeblock id="GUID-9FAAD21B-A160-5CAC-B059-32102B479236" xml:space="preserve">_LIT(KFileName,"D:\\MyCalFile");
session-&gt;OpenL(KFileName); //pass the filename D:\MyCalFile to be opened</codeblock> <p> <b> Note:</b> The session object must be destroyed only after all the objects which were created by referencing it have been destroyed. </p> </li> <li id="GUID-088A87F3-4137-55E4-B1A4-C4B4E9F93A5B"><p>list the files in the server using <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession::ListCalFilesL()</apiname></xref>. </p> </li> <li id="GUID-64B874D2-4F0F-5BB8-8640-AA0AFF908BF1"><p>delete a file using <xref href="GUID-609318A7-43F1-3FC1-952B-146B1EA8115D.dita"><apiname>CCalSession::DeleteCalFileL()</apiname></xref>. </p> </li> </ul> </conbody></concept>