none
how to get and set timezone in one appointment in outlook RRS feed

  • Question

  • I want to get and set timezone for one appoint, I used the code below to get current timezone of current appointment, but there is always bulild error says "error C2065: '_TimeZone' : undeclared identifier"

    		CComQIPtr<Outlook::_TimeZone> zone;
    	        spApptmt->get_StartTimeZone(&zone);

    Thursday, June 28, 2012 3:18 AM

Answers

  • Do you see the StartTimeZone property in the msoutl.tlh file produced by #import?

    How did you declare the spApptmt variable?

    Here is what I see in the msoutl.tlh:

    struct__declspec(uuid("00063033-0000-0000-c000-000000000046")) _AppointmentItem : IDispatch {

    ... 

          virtual HRESULT __stdcall get_StartTimeZone (
            /*[out,retval]*/ struct _TimeZone * * StartTimeZone ) = 0;
          virtual HRESULT __stdcall put_StartTimeZone (
            /*[in]*/ struct _TimeZone * StartTimeZone ) = 0;

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, June 29, 2012 1:54 PM

All replies

  • StartTimeZone property was introduced in Outlook 2007.

    Are you using the right header files?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Thursday, June 28, 2012 6:14 AM
  • Hi,

    I think it should include the property since I am using office 2010, and the lib is right.

    Thursday, June 28, 2012 8:16 AM
  • Outlook 2010 is what you might have installed, but what is the version off Outlook used to import the type library and create the headers?

    Do you use a static header file (#include)  or import (#import ...) the type library at compile time?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Thursday, June 28, 2012 2:46 PM
  • I did used import (#import ...) the type library at compile time, and I think it works fine cause other object like application, appointmentitem are all recognized.
    Friday, June 29, 2012 1:00 PM
  • Do you see the StartTimeZone property in the msoutl.tlh file produced by #import?

    How did you declare the spApptmt variable?

    Here is what I see in the msoutl.tlh:

    struct__declspec(uuid("00063033-0000-0000-c000-000000000046")) _AppointmentItem : IDispatch {

    ... 

          virtual HRESULT __stdcall get_StartTimeZone (
            /*[out,retval]*/ struct _TimeZone * * StartTimeZone ) = 0;
          virtual HRESULT __stdcall put_StartTimeZone (
            /*[in]*/ struct _TimeZone * StartTimeZone ) = 0;

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, June 29, 2012 1:54 PM
  • I declared appointment as this way:

    CcomPtr<Outlook::_appointmentItem> appt;

    As for if _TimeZone is included in the tlh file, I will check it tomorrow cause I am not in my office now.

    Thanks.

    Friday, June 29, 2012 3:31 PM
  • Not the _TimeZone object, I meant the StartTimeZone property.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, June 29, 2012 3:34 PM
  • Yes, you are right.

    I checked the msoutl.tlh and found that there is no StartTimeZone property and TimeZone object.

    I think I just used the wrong lib as your say.

    I am trying to set the timezone to see if it works.

    Saturday, June 30, 2012 3:28 AM
  • Were you able to import the type library correctly?

    How does your #import statement look like?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Saturday, June 30, 2012 3:58 AM
  • Sara,

    Do you still need assistance on this query? or I will close this thread.

    thanks,


    Forrest Guo | MSDN Community Support | Feedback to manager

    Wednesday, July 4, 2012 2:23 PM
    Moderator