PRB: MAPI_W_PARTIAL_SUCCESS When Creating a Forward Rule

ID: Q180200

The information in this article applies to:

SYMPTOMS

Creating rules to forward mail to other users is common. Forwarding rules created using HrStringToAction(), HrStringToRestriction(), and HrInsert() returns a MAPI_W_PARTIAL_SUCCESS on the HrInsert() even though the other two calls HrStringToAction() and HrStringToRestriction() complete successfully.

CAUSE

The restriction for a forwarding rule requires the FL_LOOSE flag. The address list that is part of the action structure is missing the PR_RECIPIENT_TYPE property.

RESOLUTION

Add the following code after the call to create the restriction:

   lpRes->res.resContent.ulFuzzyLevel =   FL_SUBSTRING |
                                          FL_IGNORECASE |
                                          FL_LOOSE;

Add the following code after the call to create the action:

   if (lpActs->lpAction->acttype == OP_FORWARD)
   {
      lpActs->lpAction[0].lpadrlist->aEntries->ulReserved1 = 1L;
      lpActs->lpAction[0].lpadrlist->aEntries->cValues += 1;
      lpActs->lpAction[0].lpadrlist->aEntries->
          rgPropVals[0].Value.MVbin.lpbin +=
          sizeof(SPropValue)/sizeof(SBinary);
      memset(&(lpActs->lpAction[0].lpadrlist->aEntries->
          rgPropVals[lpActs->lpAction[0].lpadrlist->
          aEntries->cValues-1]),254,sizeof(SPropValue));
      lpActs->lpAction[0].lpadrlist->aEntries->
          rgPropVals[lpActs->lpAction[0].lpadrlist->
          aEntries->cValues-1].ulPropTag = PR_RECIPIENT_TYPE;
      lpActs->lpAction[0].lpadrlist->aEntries->
          rgPropVals[lpActs->lpAction[0].lpadrlist->
          aEntries->cValues-1].Value.ul = MAPI_TO;
    }

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

1. Create a restriction using HrStringToRestriction().

2. Create an action using the HrStringToAction().

3. Insert the rule into the rules table.

Keywords          : kbAPI kbEDK kbMsg 
Version           : WINDOWS:5.0
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: February 5, 1998