Microsoft Internet Security and Acceleration Server 2004 SDK |
The following is a C++ code fragment that adds a new schedule called "Extended Work Hours," which includes all hours on all days. This code was written as a Windows Console Application. To use this code:
//Import the ISA Server Msfpccom.dll file so that ISA Server COM objects can be used. //Use the path to your ISA Server installation directory, or search for Msfpccom.idl. #import "d:\Program Files\Microsoft ISA Server\msfpccom.dll" #include <iostream.h> int main () { try { // Define variables. HRESULT hr; //Initialize the COM library on the current thread. hr = CoInitialize( NULL ); { // Define variables. FPCLib::IFPCPtr sipRoot; FPCLib::IFPCSchedulesPtr sipMyScheduleCol; FPCLib::IFPCSchedulePtr sipMySchedule; // Create the ISA Server root object. hr = sipRoot.CreateInstance("FPC.Root"); //Retrieve the schedules collection. sipMyScheduleCol = sipRoot->GetContainingArray()->PolicyElements->Schedules; //Add the new schedule. sipMySchedule = sipMyScheduleCol->Add("My New Schedule"); //Set the schedule. sipMySchedule->Set(FPCLib::fpcALL_WEEK, FPCLib::fpcALL_DAY); //Save your changes. sipMyScheduleCol->Save(); } } catch (_com_error& e) { cout << "Error. HRESULT message is: \"" << e.ErrorMessage() << "\" (" << e.Error() << ")" << endl; if (e.ErrorInfo()) { cout << (char *)e.Description() << endl; } } CoUninitialize(); return 0; }