SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    May 2005
    Location
    USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Unable to Import XML File from QC Attachment

    Hi,
    I'can import Excel Files from QC using the below code, but when i tried for XML Files, i got FIle Not found,
    While debugging i found that,
    Original File name is : MyXMLFile.xml
    But QC Gets the attachment name as : ALL_LIST_26517_MyXMLFile.xml

    That is the reason it says file not found.

    This is the Code, I'm Using QTP 9.2 & QC 9.2

    Please give your solutions,
    Thanks in advance
    -SK

    '======================================
    Function GetF(FN,Src,Dest)
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set tdc =QCUtil.QCConnection
    set tm = tdc.TreeManager
    Set folder = tm.nodebypath(Src)
    Set fact = folder.Attachments
    Set alist = fact.NewList("")

    For Each att In alist
    Set ext = att.AttachmentStorage
    attname = att.DirectLink

    If InStr(attname, FN) > 0 Then
    ext.Load attname, True
    fso.CopyFile ext.ClientPath & "\" & attname, Dest & FN
    RP "The File ["&FN&"] is extracted to Local Folder","The File ["&FN&"] is extracted and placed in Local folder for importing to QTP"
    else
    RF "The File ["&FN&"] is not found in the mentioned Folder","The File ["&FN&"] is not found in folder for importing"
    End If

    Exit For

    Next
    End Function
    '=====================================
    SK_VEL™

  2. #2
    Senior Member
    Join Date
    Dec 2006
    Location
    Germany, Dresden
    Posts
    1,536
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to Import XML File from QC Attachment

    try the code below, it will download the attachment from a specified folder and give you back the complete path and filename, the code will work for a FOLDER ATTACHMENT
    <font color="blue">
    Public Function a_ext_get_FolderAttachment(TDAttachmentName, TDFolderPath)
    ...
    ...
    Set otaTreeManager = QCUtil.TDConnection.TreeManager
    Set otaSysTreeNode = otaTreeManager.NodeByPath(TDFolderPath)
    Set otaAttachmentFactory = otaSysTreeNode.Attachments
    Set otaAttachmentFilter = otaAttachmentFactory.Filter
    otaAttachmentFilter.Filter("CR_REFERENCE") = "'ALL_LISTS_" &amp; otaSysTreeNode.NodeID &amp; "_" &amp; TDAttachmentName &amp; "'"
    Set otaAttachmentList = otaAttachmentFilter.NewList
    If otaAttachmentList.Count &gt; 0 Then
    Set otaAttachment = otaAttachmentList.Item(1)
    otaAttachment.Load True, ""
    strPath = otaAttachment.FileName
    Else
    a_ext_reportevent micFail, "Failure in library function 'a_ext_getFolderAttachmentPath'", _
    "Failed to find attachment '" &amp; TDAttachmentName &amp; "' in folder '" &amp; TDFolderPath &amp; "'."
    End If
    a_ext_get_FolderAttachment = strPath

    End Function</font>
    http://qcmt.pc-polis.de

    de omnibus dubitandum

    For all Questions: Please be sure to take a look at the QTP Manual before posting any Questions, thanks for doing this

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:58 PM.

Copyright BetaSoft Inc.