Results 1 to 3 of 3
  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Author information wanted (Outlook 2003/SP2)

    I'm designing a custom form based on the task form.
    I need to capture the user name of the person who creates the task
    I have looked at the following fields
    Author - remains blank
    Owner - defaults to the name of the mailbox where form resides (which is not what I want)
    Organizer- remains blank
    Role - remains blank

    So in frustration, I created a custom field "Creator2" and wrote the following script and saved it in the form.
    Function Item_Open()
    Dim strCurrentUser 'as String

    strcurrentuser=Application.GetNamespace("MAPI").Cu rrentUser
    item.userproperties("Creator2")=strcurrentuser
    End Function

    This works beautifully, until I try to run it from a the form residing in the shared mailbox. In which case no code will run at all.

    Following advice I placed the form in Personal Library, where it will run - but now it saves to the wrong location. <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

    Any suggestions?
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Author information wanted (Outlook 2003/SP2)


  3. #3
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Author information wanted (Outlook 2003/SP2)

    Worked beautifully and just a reminder to anyone following this thread, that since the code sets the user name on open, you'll need to prevent it from changing anytime another user opens the item.

    Function Item_Open()
    Dim strCurrentUser 'As String
    strcurrentuser = item.userproperties("Creator")
    if Len(strcurrentuser)=0 then
    strcurrentuser=Application.GetNamespace("MAPI").Cu rrentUser
    item.userproperties("Creator").value=strcurrentuse r
    'msgbox strcurrentuser
    else
    end if
    End function
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •