mapiutils.h

来自「funambol window mobile客户端源代码」· C头文件 代码 · 共 125 行

H
125
字号
/*
 * Funambol is a mobile platform developed by Funambol, Inc.
 * Copyright (C) 2003 - 2007 Funambol, Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by
 * the Free Software Foundation with the addition of the following permission
 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
 * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 *
 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Powered by Funambol" logo. If the display of the logo is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by Funambol".
 */


#ifndef INCL_MAPI_UTILS
#define INCL_MAPI_UTILS

#include <windows.h>
#include "pimstore.h"
#include "base/Log.h"
#include "spds/constants.h"
#include "vocl/WinContact.h"
#include <string>

using namespace std;

/// Returns the oid of the given IItem.
long getIItemOid(IItem *pItem);

/**
 * Returns a wstring that contains the string value of the given CEPROPVAL structure.
 * No conversion applied.
 */
wstring getStringPropertyFromMapi(const CEPROPVAL *pValSrc);

/**
 * Returns a wstring that contains the date value of the given CEPROPVAL structure.
 * The date is converted into format:
 *    "yyyyMMdd"         if onlyDate is true
 *    "yyyyMMddThhmmss"  if onlyDate is false
 *    "yyyyMMddThhmmssZ" if onlyDate is false and toUTC is true
 * If toUTC is true, the date is converted from local to UTC time.
 */
wstring getDatePropertyFromMapi(const CEPROPVAL *pValSrc, bool toUTC, bool onlyDate);

/**
 * Returns the int value of the given CEPROPVAL structure.
 * No conversion applied.
 */
int getIntPropertyFromMapi(const CEPROPVAL *pValSrc);

/**
 * Returns the (new allocated) structure with timezone for the appointment.
 * Returns NULL if info not found in MAPI.
 */
TIME_ZONE_INFORMATION* readTimezoneFromMapi(const CEPROPVAL *pValSrc);


/**
 * Opens the IItem contact, and gets the picture property.
 * The picture content is saved to a tmp file, then returned as a b64 wstring.
 * The picture format (jpg/gif/...) is retrieved and set into the winC object.
 * @param pContact  the IItem to read
 * @param winC      the destination WinContact object
 * @return          the b64 wstring which is the content of the picture
 */
wstring getPicturePropertyFromMapi(IItem *pContact, WinContact& winC);


/// Sets the int propValue in the given CEPROPVAL structure.
void setIntPropertyToMapi   (CEPROPVAL *pValSrc, CEPROPID propId, const int propValue);

/// Sets the FILETIME propValue in the given CEPROPVAL structure.
void setDatePropertyToMapi  (CEPROPVAL *pValSrc, CEPROPID propId, const FILETIME propValue);

/// Sets the string propValue in the given CEPROPVAL structure.
void setStringPropertyToMapi(CEPROPVAL *pValSrc, CEPROPID propId, const wstring& propValue);

/// Sets the timezone information in the given CEPROPVAL structure.
void setTimezoneToMapi(CEPROPVAL *pValSrc, CEPROPID propId, const TIME_ZONE_INFORMATION* tz);

/**
 * Sets all the numProps properties contained in the CEPROPVAL structure, into the IItem pItem.
 * Then, if operation succesfull, the IItem is saved in pOutlook.
 * @param pItem           the IItem to set properties and to save
 * @param numProps        number of properties to set
 * @param prgPropvalPoom  pointer to the CEPROPVAL structure where numProps properties have
 *                        been already set
 * @return                S_OK = 0 if operation succesfull, < 0 if errors
 *
 * @note  numProps passed MUST correspond to the number of properties effectively
 *        set in prgPropvalPoom. prgPropvalPoom structure MUST be previously allocated
 *        to receive numProps properties. This operation is very delicate.
 */
HRESULT saveItemProps(IItem* pItem, int numProps, CEPROPVAL* prgPropvalPoom);


// **** TODO: move into API ****
FILETIME getDatePropertyFromString(const wstring& date, bool onlyDate = false);
int getIntPropertyFromWinItem(const wstring& value);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?