问题
I understand that Outlook has set items, i.e. Mail, Task, Calendar, Notes, etcetera. How can you create a custom Item that Outlook will recognize as the others? I know that when you add the Business Contact Manager it creates Items like "Opportunities"
Can you override an Item, or inherit an Item and alter/add properties and methods?
examples:
olAppointmentItem 1 Represents an AppointmentItem
olContactItem 2 Represents a ContactItem
olDistributionListItem 7 Represents an DistListItem
olJournalItem 4 Represents a JournalItem
olMailItem 0 Represents a MailItem
olNoteItem 5 Represents a NoteItem
olPostItem 6 Represents a PostItem
olTaskItem 3 Represents a TaskItem
回答1:
You cannot create new "types"; but you can certainly re-use the existing types by adding your own properties.
That comment is not correct. you can certainly use custom forms, you just need to publish them first to a forms library, and make them accesible to users. generally they are based on the design of one of the default item types, and can also be associated with a folder as the default item type.
Edit: (updating post as per comment request)
A.Create and publish a custom form - http://office.microsoft.com/en-au/outlook/HA012106101033.aspx
B. programmatically create an instance of the custom form.
Outlook.Application olApp = new Outlook.Application();
//mapifolder for earlier versions (such as ol 2003)
Outlook.Folder contacts = olApp.Session.GetDefaultFolder(Outlook.olDefaultFolders.olFolderContacts);
//must start with IPM. & must be derived from a base item type, in this case contactItem.
Outlook.ContactItem itm = (Outlook.ContactItem)contacts.Items.Add(@"IPM.Contact.CustomMessageClass");
itm.Display(false);
回答2:
Outlook has the ability to create custom forms. You use the forms designer bultin to outlook, there is one built all versions of Outlook. You can launch a design session with the Tools | Forms | Design a Form command. Alternatively, open any Outlook item in Outlook 2003 or earlier and choose Tools | Forms | Design This Form.
When you design a form you start based on on of the exiting form such a appointment, task etc.. The closest thing to a blank form is the post form.
Forms can have VBScript code behind them to react to user actions -- validating data, synchronizing it with databases, creating new Outlook items, etc. To add code, once you're in form design mode, click the View Code command on the toolbar or ribbon.
You can then publish you form into the Organization Forms library, so that everyone has access to them. They can also be published directly to a folder. Personal forms are published either to a folder or to your Personal Forms library.
There is quite a lot of help documentation for this kind of thing in Outlook Help, also google will return loads of sites that show you how.
回答3:
You cannot create new "types"; but you can certainly re-use the existing types by adding your own properties.
来源:https://stackoverflow.com/questions/842285/how-do-i-create-a-custom-outlook-item