SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    how to delete attachments?

    I am not sure if this is crazy, Every time I download attachment and modify content and upload I am getting a new name(http://www.sqaforums.com/showflat.ph...e=0#Post431444). That is an issue for me. Because everytime I am updating data in the attachment so that the data that ran in test is marked and don't update them again.

    I am doing this way because I don't have access to DB and they won't give me. And my tests are in QC.

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Did you check

    http://www.sqaforums.com/showflat.ph...;Number=330689
    <font class="small">Code:</font><hr /><pre>
    I think you have 2 options here. First to update the file and second to remove and add the file...i will give you some direction on how to go about it

    1st Method

    Set attf = vTest.Attachments
    Set attList = attf.NewList("")
    'now here search for the attachment you are looking for
    'using attList.item(i) and attList.count

    set attFound=attList.item(2) 'say the item is found at i=2
    now update the file
    attFound.FileName="C:\NewFile.xls"
    attFound.Post

    Now the above code may or may not work...i am not sure if it allows to update a file this way..so you will have to try this

    2nd Method
    This is same as above till the below line
    set attFound=attList.item(2) 'say the item is found at i=2

    now after this we need to remove the attachment

    attList.RemoveItem attFound.ID

    and now add the new attachment using the one that you already have.

    Hope this helps
    </pre><hr />

  3. #3
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Both are not working. See the screen shots
    Attached Images Attached Images

  4. #4
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Another Screen Shot
    Attached Images Attached Images

  5. #5
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Try this.

    <font class="small">Code:</font><hr /><pre>
    Set attf = vTest.Attachments
    Set attList = attf.NewList("")

    For each file in attList
    Print file.Name(1)
    if lcase(file.Name(1)) = "default.xls" then
    attList.RemoveItem file.ID
    Next
    </pre><hr />

  6. #6
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    this code just came out printing "data.xls" the file that I attached.

    I also tried changing default.xls with my file name data.xls and got the same error when it tried to delete

    "Object doen't support this property or method 'attlist.removeitem"

  7. #7
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    My bad...should be

    attf.RemoveItem file.ID

    But you should do some R&amp;D from your side also. People are not here to teach you for each and everything

  8. #8
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    I tried a lot to findout the QTP Architecture API document which is supposed to have details on this API, I could not get one. Will be happy if you point me too..

  9. #9
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Did this work that I gave you? i got it from QTP API documentation file..

  10. #10
    Junior Member
    Join Date
    Oct 2007
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to delete attachments?

    Yes Tarun. Thank you very much. Where do I get that QTP API documentaion ?

 

 
Page 1 of 2 12 LastLast

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 12.00%
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 07:48 PM.

Copyright BetaSoft Inc.