none
VBA Outlook 2016 filepath ? RRS feed

  • Question

  • Hello,
    I'am a french people who have developped some code in VBS,VBA and Hta on Outlook 
    (Sorry for my english).

    I have a problem with outlook 2016 whith the "filepath" of object Stores.
    Most of the pst files are on the network.
    Some files seems to be correct 
    "Filepath" : \\eur.msd.world.xxx\PST\ARMAIL4902\test\A391062\fi le.pst
    Others files not and return
    "Filepath" \\?\UNC\eur.msd.world.xxx\... 
    Before this outlook version all are correct.
    Do you have an idea ?

    Thanks,

    Thierry.
    Friday, December 1, 2017 8:10 AM

Answers

  • Hi Thierry,

    >>so i have add a workaround code like that : Sto_filepath=replace(Store.filepath,"\\?\UNC\","\\")

    Thanks for sharing the workaround, I would suggest you mark your reply as answer, and then others who run into the same issue would find the solution easily.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Thierryppp Tuesday, December 19, 2017 8:08 AM
    Monday, December 18, 2017 7:51 AM

All replies

  • Hello Thierry,

    What code do you use? What's the current file path of the "\\?\UNC\eur.msd.world.xxx\... "? Is there any character that your current VBE does not support? 

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 4, 2017 6:04 AM
  • Hello Terry

    Here a peace of code :

    -------

    For Each store In objNamespace.Stores
    If store.IsDataFileStore Then
    iSize = objFSO.GetFile(store.filepath).Size
    StrStream = store.displayname & " : " & ConvertSize(iSize) & "-" & store.filepath

    --------

    I have 10 network pst file : some of "filepath" are correct like \\eur.msd.world.xxx\...  and some are with "\\?\UNC\eur.msd.world.xxx\...  The iSize is correct...

    Before outlook 2016 all the "filepath" was correct like \\eur.msd.world.xxx\...

    Best regards

    Thierry.

    Monday, December 4, 2017 8:07 AM
  • Hello Thierry,

    What is the actual value of the "?" in "\\?\UNC\eur.msd.world.xxx\... "? In my test, if we use a foreign character which VBE could not identify, such as chinese characters "测试", it will be replace with "??" when debug printing since VBE does not identify it.

    So, I would suggest you check if all the characters in the path string could be identify by VBE. You could debug print the path directly to check it.

    Best Regards,

    Terry 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 4, 2017 9:37 AM
  • Hello Terry,

    Thanks for your answer but it's not a problem of a foreign character...

    My code is on VBS and I have tested on VBA ==> same problem. 

    All the 10 files are on the same directory and the problem is new with Outlook 2016.

    Before this outlook version all the files was correct with \\eur.msd.world.xxx\....

    Regards,

    Thierry.

    Monday, December 4, 2017 10:01 AM
  • Hello,

    Please right click the Outlook Data File, select Data File Properties, click Advanced to check the file name. 

    I got similar file path in Version 1711 Build 8730.2107. The same file shows correct path in Outlook 2013. 

    Our forum(Outlook for Developers) is for development issues when using Outlook Object Model. According to the test result and your description. The issue is not related to Outlook Object Model. I think it might cause from Office updates as your old version works fine.

    Please post on the following forum about this non-programming issue. Sorry for any inconvenience.

    https://social.technet.microsoft.com/Forums/office/en-US/home?forum=outlook


    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 5, 2017 6:11 AM
    Moderator
  • Hello Terry,

    You are right  when on Outlook 2016 I right click the Outlook Data File,and  select Data File Properties, and click Advanced to check the file name.

    All the 10 network pst files name  got similar filepath like "\\?\UNC\eur.msd.world.xxx\...  (all)

    But with a code use the outlook object model. It's not True

    some are \\?\UNC\eur.msd.world.xxx\.

    some are \\UNC\eur.msd.world.xxx\.

    It's strange... here a VBS (transform from VBA) code :

    ''' Transformation en VBS
     Dim objOutlook,objNamespace
     Set objOutlook = CreateObject("Outlook.Application")
     Set objNamespace = objOutlook.GetNamespace("MAPI")
     Dim Chaine_pst,Chaine_Filepath
    '''
    EnumerateFoldersInStores()  ' appel routine
    '''
    wscript.echo "Les filepath : " & VbCrLf  & VbCrLf & chaine_filepath
    msgbox "Nombre_store : " & Nombre_store & VbCrLf & chaine_pst,48,"Les PST"
    '''
    Sub EnumerateFoldersInStores() 
     Dim colStores '''As Outlook.Stores 
     Dim oStore '''As Outlook.Store 
     Dim oRoot '''As Outlook.Folder 

    ''' nombre_store
     Dim Nombre_store : Nombre_store=0
     On Error Resume Next 

     '''Set colStores = Application.Session.Stores
     Set colStores = objNamespace.Stores

     For Each oStore In colStores 
    '''
    Nombre_store=Nombre_store+1
    Set oRoot = oStore.GetRootFolder 
     '''Debug.Print (oRoot.FolderPath) 
    chaine_pst = chaine_pst & (oRoot.FolderPath) & VbCrLf
    Chaine_filepath=chaine_filepath & "---" & oStore.filepath & VbCrLf 
     Next
    '''
    end SUB

    ---

    Thierry.

    Tuesday, December 5, 2017 8:14 AM
  • Hello,

    Please visit Error when you add a PST or OST file on a non-local drive in Outlook 2016

    Starting with build 16.0.7910.1000, Outlook 2016 makes a specific call to an operating system component to determine the canonical path. With the change, the GetFinalPathNameByHandle Windows API returns the normalized path to a file. In the case of a mapped drive, GetFinalPathNameByHandle converts the path into the Universal Naming Convention (UNC) format. When converting the path, Windows must traverse the entire folder structure of the path to build the final name. If there are insufficient permissions to any folder in the UNC path, GetFinalPathNameByHandle will be unable to return a normalized path. As a result, Outlook 2016 can’t add any .pst files from this location.

    I think your issue might also cause from the change.

    I suggest you copy the .pst file to a local hard drive or follow https://support.microsoft.com/en-us/help/2770432/how-to-revert-to-an-earlier-version-of-office-2013-or-office-2016-clic to revert to an earlier version of Office 2016.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 5, 2017 8:34 AM
    Moderator
  • Hello Celeste.

    All my network pst are open in outlook Office 365 ProPlus Version 1705 and i have no problem to read all the mails.

    All the network pst in outlook return \\?\UNC\eur.msd.world.xxx\...   ==> right click the Outlook Data File, select Data File Properties, click Advanced to check the file name. (It's like that why not)

    My  question is just about a code (VBS/VBA/HTA)  to list all the pst.

    My code work fine with the outlook object model, and return all the informations.

    I have just a little problem with the filepath return some are \\?\UNC\eur.msd.world.xxx\... ==> It's conforme with Outlook directly but  some are \\UNC\eur.msd.world.xxx\...   It's strange...

    It's just an interrogation, i don't understand why, but it doesn't matter...

    Thnaks,

    Thierry.

    Tuesday, December 5, 2017 10:46 AM
  • Hello Thierry,

    Could Chenchen's explanation help you? If could, I would suggest you mark helpful reply to close this thread. If you have any other issue, please feel free to post to let us know.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 7, 2017 8:43 AM
  • Hello Tery,

    No Chenchen's explanation isn't the problem for me.

    I have no problem with insufficient permissions, I can read in Outlook all the network pst files.

    My code (VBA/VBS) outside of outlook with the "CreateObject("Outlook.Application")" return for some pst file :

    \?\UNC\eur.msd.world.xxx\...

    It's conforme like in outlook directly (with right click the Outlook Data File, select Data File Properties, click Advanced to check the file name)

    But some pst file return :

    \\eur.msd.world.xxx\...

    It's strange; why this difference (all my network pst file are on the same network directory)

    Regards,

    Thierry.

    Thursday, December 7, 2017 9:19 AM
  • Hi Thierry,

    >>It's strange; why this difference (all my network pst file are on the same network directory)

    If you delete both pst files and then re-add them again, will it still show different pst file path if they are on the same network directory?

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 13, 2017 8:25 AM
  • Hello Tao Zhou,

    It's the same problem.

    My feeling is that : with the VBS code to call "Outllok objet" there is a bug with the network pst.

    when you call the "store.filepath" we have some result like \\?\UNC\Eur.x.y\... other like \\Eur.x.y\...

    It's strange...

    The second return value is better for me.

    so i have add a workaround code like that : Sto_filepath=replace(Store.filepath,"\\?\UNC\","\\")

    Regards,

    Thierry.

    Friday, December 15, 2017 5:33 PM
  • Hi Thierry,

    >>so i have add a workaround code like that : Sto_filepath=replace(Store.filepath,"\\?\UNC\","\\")

    Thanks for sharing the workaround, I would suggest you mark your reply as answer, and then others who run into the same issue would find the solution easily.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Thierryppp Tuesday, December 19, 2017 8:08 AM
    Monday, December 18, 2017 7:51 AM