Smartsheet.Api.Internal.SheetAttachmentResourcesImpl.ListAttachments C# (CSharp) Method

ListAttachments() public method

public ListAttachments ( long sheetId, PaginationParameters paging ) : PaginatedResult
sheetId long
paging Smartsheet.Api.Models.PaginationParameters
return PaginatedResult
        public virtual PaginatedResult<Attachment> ListAttachments(long sheetId, PaginationParameters paging)
        {
            StringBuilder path = new StringBuilder("sheets/" + sheetId + "/attachments");
            if (paging != null)
            {
                path.Append(paging.ToQueryString());
            }
            return this.ListResourcesWithWrapper<Attachment>(path.ToString());
        }

Usage Example

        public virtual void TestListAttachments()
        {
            server.setResponseBody("../../../TestSDK/resources/listAttachments.json");
            PaginatedResult <Attachment> result = sheetAttachmentResource.ListAttachments(56545654, null);

            Assert.IsTrue(result.Data[0].AttachmentType == AttachmentType.FILE);
            Assert.IsTrue(result.Data[0].MimeType == "image/png");
            Assert.IsTrue(result.Data[0].Id == 4583173393803140);
            Assert.IsTrue(result.Data[0].ParentType == AttachmentParentType.SHEET);
            Assert.IsTrue(result.Data[0].Name == "att3.png");
            Assert.IsTrue(result.Data[0].ParentId == 341847495283);

            Assert.IsTrue(result.Data[1].AttachmentType == AttachmentType.FILE);
            Assert.IsTrue(result.Data[1].MimeType == "image/png");
            Assert.IsTrue(result.Data[1].Id == 4583173393803140);
            Assert.IsTrue(result.Data[1].ParentType == AttachmentParentType.ROW);
            Assert.IsTrue(result.Data[1].Name == "att4.png");
            Assert.IsTrue(result.Data[1].ParentId == 684956754834557);
        }