Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TDSE.GetObject doesn't resolve a WebDAV URL with dots in it

Anyone experienced exception using below function?

tdse.GetObject(tmpFolderWebDavURL, EnumOpenMode.OpenModeView, null,
                                          XMLReadFilter.XMLReadAll) as Folder;

Seems if the last segment of webdav contains a dot then the method throws and exception.

for example

tmpFolderWebDavURL = "/webdav/test_publication/2.2 folder name" - fails exception thrown

tmpFolderWebDavURL = "/webdav/test_publication/22 folder name" - works

tmpFolderWebDavURL = "/webdav/test_publication/2.2 folder name/sub_folder" - works

Exception

<?xml version="1.0"?>
<tcm:Error xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ErrorCode="80040200" Category="4" Source="Kernel" Severity="2">
    <tcm:Line ErrorCode="80040200" Cause="false" MessageID="15301">
        <![CDATA[Unable to get TOM object for URI: /webdav/TPMG Medical Library Content/Building Blocks/Content Live/2.2 People Lists]]>
        <tcm:Token>/webdav/TPMG Medical Library Content/Building Blocks/Content Live/2.2 People Lists</tcm:Token>
    </tcm:Line>
    <tcm:Line ErrorCode="80040200" Cause="true" MessageID="15748">
        <![CDATA[Unable to map all paths to URIs.]]>
    </tcm:Line>
    <tcm:Details>
        <tcm:CallStack>
            <tcm:Location>SystemDAL.GetURIsFromPaths</tcm:Location>
            <tcm:Location>SystemDAL.GetURIsFromPaths</tcm:Location>
            <tcm:Location>URLConversion.ConvertURLToURI</tcm:Location>
            <tcm:Location>SystemBLST.IBLSystemST_ConvertURLToURI</tcm:Location>
            <tcm:Location>TDSE.GetObject</tcm:Location>
        </tcm:CallStack>
    </tcm:Details>
</tcm:Error>
like image 696
Chris Morgan Avatar asked Apr 10 '12 20:04

Chris Morgan


2 Answers

Just like with spaces, dots must be escaped in webdav URLs.

So a space becomes "%20", a dot becomes "%2E". Try doing tmpFolderWebDavURL.Replace(".", "%2E").

like image 197
Nuno Linhares Avatar answered Oct 09 '22 20:10

Nuno Linhares


This is another reason to have the powershell open whenever you are doing this kind of development.

Assuming you know the tcm uri of the item, you can get the correct WebDAVURL very easily:

> $tdse = new-object -com TDS.TDSE
> $sch = $tdse.GetObject("tcm:3-92723-8",1)
> $sch.info.WebDAVURL
/webdav/00_Schemas_003/Building%20Blocks/Schemas/Component/ComponentStaffItem.xsd

A quick copy-paste and you're done!

like image 45
Dominic Cronin Avatar answered Oct 09 '22 20:10

Dominic Cronin