Skip to content

Create ticket article with attachment returns file not found #43

Description

@kibernetik542

My code looks like:

                ```
               var userClient = _account.CreateUserClient();
                var ticketClient = _account.CreateTicketClient();
                var user = await userClient.CreateUserAsync(new User
                {
                    Login = dto.Username,
                    FirstName = dto.Username,
                    Active = true
                });
                _account.UseOnBehalfOf(user.Login);

                var ticket = await ticketClient.CreateTicketAsync(
                    new Ticket
                    {
                        Title = dto.Title,
                        GroupId = 1,
                        CustomerId = user.Id,
                        OwnerId = user.Id,
                        OrganizationId = dto.OrganizationId
                    },
                    new TicketArticle
                    {
                        Subject = dto.Title,
                        Body = dto.Body
                    });
                string path = null;
                if (dto.Logo is {Length: > 0})
                {
                    path = Path.GetFullPath(dto.Logo.FileName);
                }

                var article = await ticketClient.CreateTicketArticleAsync(new TicketArticle
                {
                    TicketId = ticket.Id,
                    Body = dto.Body,
                    Subject = dto.Title,
                    Attachments = new List<TicketAttachment>
                    {
                        TicketAttachment.CreateFromFile(path, dto.Logo.ContentType),
                        new TicketAttachment()
                        {
                            Filename = path,
                            MimeType = dto.Logo.ContentType
                        }
                    }
                });


And it always returns file not found, if I will not use TicketAttachment.CreateFromFile it will not return Unprocessible Entity.
File I want to upload simple png image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions