Skip to content

Change Attachment interface to allow bytes instead of file path #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dantebarba opened this issue Nov 19, 2024 · 1 comment · Fixed by #380
Closed

Change Attachment interface to allow bytes instead of file path #368

dantebarba opened this issue Nov 19, 2024 · 1 comment · Fixed by #380

Comments

@dantebarba
Copy link

Would be great if the Attachment entity could be changed to allow bytes alongside file paths.

        # Create the Attachable object
        attachable = Attachable()
        attachable.FileName = "thumbnail.jpg"
        attachable.ContentType = "image/jpeg"  # Assuming JPEG format
        attachable._FilePath = temp_file_path  # Provide the temporary file path

        # Link the Attachable to the Item
        attachable.AttachableRef = [
            {
                "EntityRef": Ref(value=item_id, type="Item"),
                "IncludeOnSend": False,
            }
        ]

        # Save the attachment
        attachable.save(qb=qb_client)

Something like attachable._FileBytes would be fine.

@ej2
Copy link
Owner

ej2 commented Apr 16, 2025

Added in 0.9.12

@ej2 ej2 closed this as completed Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants