Code Monkey home page Code Monkey logo

Comments (4)

tedchamb avatar tedchamb commented on May 23, 2024 2

The fix has been released in 0.1.24

Example method to upload a file and link it as a work item attachment:

def upload_work_item_attachment(wit_client, work_item_id, file_name, callback=None):
    # upload file / create attachment
    with open(file_name, 'r+b') as file:
        # use mmap, so we don't load entire file in memory at the same time, and so we can start
        # streaming before we are done reading the file.
        mm = mmap.mmap(file.fileno(), 0)
        attachment = wit_client.create_attachment(mm, file_name=file_name, callback=callback)

    # Link Work Item to attachment
    patch_document = [
        JsonPatchOperation(
            op="add",
            path="/relations/-",
            value={
                "rel": "AttachedFile",
                "url": attachment.url
            }
        )
    ]
    wit_client.update_work_item(patch_document, work_item_id)

from azure-devops-python-api.

tedchamb avatar tedchamb commented on May 23, 2024

Similar issue to #29. When we fix #29, this should be fixed as well.

from azure-devops-python-api.

tedchamb avatar tedchamb commented on May 23, 2024

Fix is in #163

from azure-devops-python-api.

jfthuong avatar jfthuong commented on May 23, 2024

I confirm, upload works fine now!

from azure-devops-python-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.