GetFolderFieldNames method

This method is intended for use with C/C++.

Method
short GetFolderFieldNames(
IUnknown * pNames,
short MaxNames )
Parameters
pNames
Points to an array of ArsOleValues to receive the folder field names. The array must have at least MaxNames elements.
MaxNames
Specifies the maximum number of names to be returned.
Description
The names of the folder fields, up to a maximum of MaxNames, are returned in pNames. Each name is a null-terminated character string.

The names are placed in the array in the same sequence that should be used with the method StoreDoc.

GetFolderFieldName or GetFolderFieldNames can be used to retrieve the folder field names. An application should use the one which is more convenient in its environment.

Return Value
Refer to return codes.
See Also
GetFolderFieldName, GetNumFolderFields, and StoreDoc

C/C++

The following example demonstrates the StoreDoc method. First the folder fields are displayed along with entry fields so that the user can enter field values. Then those values are used to store a new document into Content Manager OnDemand.
  VARIANT var;
  CArsOle * pArsCtrl;
  ArsOleName * pNames;
  short rc, j;

    .
    .

  rc = pArsCtrl->GetNumFolderFields( &var );
  if ( rc != ARS_OLE_RC_SUCCESS )
                  ERROR;
  // m_NumFolderFields is a class variable
  m_NumFolderFields = var.iVal;

  pNames = new ArsOleName[ max( m_NumFolderFields, 1 ) ];
  rc = pArsCtrl->GetFolderFieldNames( (IUnknown*)pNames,
                                       m_NumFolderFields );
  if ( rc != ARS_OLE_RC_SUCCESS )
     ERROR;
  for ( j = 0; j < m_NumFolderFields; j++ )
      GetDlgItem( IDC_FIELD1_TEXT + j )->SetWindowText( pNames[j] );

  // During OK button processing

  CArsOle * pArsCtrl;
  short rc, j;
  CString fields[16];
  SAFEARRAY * pSA;
  VARIANT var;
  BSTR bstrElement;
  long i;

  pSA = SafeArrayCreateVector(VT_BSTR, 0, m_NumFolderFields);
  if ( pSA == NULL )
     ERROR;

  for (j = 0; j < m_NumFolderFields; j++)
  GetDlgItem( IDC_FIELD1_EDIT + j )->GetWindowText( fields[j] );

  for (i = 0; i < m_NumFolderFields; i++)
  {
       bstrElement = fields[i].AllocSysString();
       if (bstrElement == NULL)
          ERROR;
       SafeArrayPutElement (pSA, &i, bstrElement);
  }

  var.vt = VT_ARRAY � VT_BSTR;
  var.parray = pSA;

  rc = pArsCtrl->StoreDoc( "G:\\download\\file.afp",
                             "BKH-CRD",
                             "BKH-CRD",
                             &var );
  if ( rc != ARS_OLE_RC_SUCCESS )
     ERROR;