IItem::SetProps

Windows Mobile SupportedWindows Embedded CE Not Supported

9/8/2008

The SetProps método define um PIM (Atualizações) lista de valores propriedade do item.

Syntax

HRESULT SetProps(
  ULONG       ulFlags,
  WORD        cProps,
   CEPROPVAL * rgVals
);

Parameters

  • ulFlags
    [no] Não usado. 0.
  • cProps
    [no] O número de valores contidos na propriedade rgVals.
  • prgVals
    [no] Referência a uma matriz de propriedade da identificação e seus associado valores. Para informações sobre CEPROPVAL, consulte CEPROPVAL.

Return Value

This method returns the standard values HRESULT_FROM_WIN32(GetLastError()), E_INVALIDARG GPSGetPosition, e E_FAIL, as well as o seguinte.

  • S_OK
    The method completed successfully. Propriedade todos os valores foram definidos com êxito.
  • S_FALSE
    Retornado se:

    • Uma ou mais dos valores de propriedade não podem ser definidas,
    • Um ou mais das propriedades originalmente tinham o mesmo valor que você tentou definir (reescrever o mesmo valor),
    • você tentar definir uma propriedade transmitir (por exemplo, PIMPR_PICTURE ou ISpTTSEngine::Speak. PIMPR_BINARY_BODY).
  • E_ACCESSDENIED
    Retornado quando você definir a PIMPR_FOLDERNOTIFICATIONS propriedade em um objeto pasta, tendo feito logon POOM com um inválido identificador janela.

Você deve chamar IAppointment::Save no compromisso antes de usar IItem::SetProps Para definir um PIMPR_MEETING_OWNER_CRITICAL_CHANGE ou ISpTTSEngine::Speak. PIMPR_ATTENDEES_CRITICAL_CHANGE. For more information, see Calendar Property ID's.

Remarks

S_FALSE é retornado se um ou mais dos valores de propriedade não podem ser definido, ou se você tentar definir uma propriedade transmitir (por exemplo, PIMPR_PICTURE ou ISpTTSEngine::Speak. PIMPR_BINARY_BODY).

Se você usar SetProps a alteração uma valor da propriedade única, nenhuma das outras propriedades item gerenciador de informações pessoais são afetados.

Exemplo de código

O seguinte exemplo de código demonstra como usar IItem::SetProps.

Observação

Para tornar o exemplo de código mais fácil para ler, verificação de segurança e manipulação de erro não estão incluídos.This code example should not be used in a release configuration unless it has been modified to include them.

HRESULT SetPropsExample(IPOutlookApp2 *pPoom, OlItemType olItemType)
{
    HRESULT hr             = E_FAIL;
    IDispatch *pDisp       = NULL;
    IItem *pItem           = NULL;
    CEPROPVAL rgPropval[2] = {0};
    SYSTEMTIME st          = {0};

    // Create a new PIM item.
    hr = pPoom->CreateItem(olItemType, &pDisp);

    // Get the IItem interface for the newly created item.
    hr = pDisp->QueryInterface(IID_IItem, (LPVOID*)&pItem);

    // Set the item properties based on the PIM item type.
    switch(olItemType)
    {
        case olAppointmentItem:

            rgPropval[0].propid     = PIMPR_SUBJECT;
            rgPropval[1].propid     = PIMPR_START;
            rgPropval[0].val.lpwstr = L"Test Appt";

            // Set the start time to the current time.
            GetLocalTime(&st);
            SystemTimeToFileTime(&st, &(rgPropval[1].val.filetime));

            break;

        case olContactItem:

            rgPropval[0].propid     = PIMPR_FIRST_NAME;
            rgPropval[1].propid     = PIMPR_EMAIL1_ADDRESS;

            rgPropval[0].val.lpwstr = L"Test Contact";
            rgPropval[1].val.lpwstr = L"someone@example.com";

            break;
        
        case olTaskItem:

            rgPropval[0].propid     = PIMPR_SUBJECT;
            rgPropval[1].propid     = PIMPR_IMPORTANCE;

            rgPropval[0].val.lpwstr = L"Test Task";
            rgPropval[1].val.ulVal  = olImportanceHigh;

            break;

        default:

            hr = E_INVALIDARG;
            goto Exit;
    }

    hr = pItem->SetProps(0, 2, rgPropval);

    /*
    Expected return value:
    hr = S_OK          All props were set and there was no error.

    hr = S_FALSE       One or more propids passed in were either invalid or a
                       propid for a stream prop. (eg: rgPropval[0].propid = 0 or
                       rgPropval[0].propid = PIMPR_BINARY_BODY).

    hr = E_INVALIDARG: One or more propvals were invalid. (eg: for the tasks
                       case where the propid is PIMPR_IMPORTANCE and the
                       rgPropval[1].val.ulVal = 100 (which is invalid).
    */

    hr = pItem->Save();

Exit:
    pDisp->Release();
    pItem->Release();

    return hr;
}

Requirements

Header pimstore.h
Library Pimstore.lib
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Reference

IItem
IMAPIProp::SetProps

Other Resources