Timestamper Class Extension
TimestamperUtils.cpp
// Copyright 2006 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.

#include "stdafx.h"
#include "TimestamperUtils.h"

HRESULT AddTimestampFields(IFieldsEditPtr& ipFieldsEdit)
{

  HRESULT hr;

  // CREATION FIELD
  IFieldEditPtr ipCreField(CLSID_Field);
  ipCreField->put_Name(g_sCreFieldDefaultName);
  ipCreField->put_Type(esriFieldTypeDate);
  hr = ipFieldsEdit->AddField(ipCreField);
  if (FAILED(hr)) return hr;

  // MODIFICATION FIELD
  IFieldEditPtr ipModField(CLSID_Field);
  ipModField->put_Name(g_sModFieldDefaultName);
  ipModField->put_Type(esriFieldTypeDate);
  hr = ipFieldsEdit->AddField(ipModField);
  if (FAILED(hr)) return hr;

  // USER FIELD
  IFieldEditPtr ipUsrField(CLSID_Field);
  ipUsrField->put_Name(g_sUsrFieldDefaultName);
  ipUsrField->put_Type(esriFieldTypeString);
  hr = ipFieldsEdit->AddField(ipUsrField);
  if (FAILED(hr)) return hr;

  return S_OK;
}