Welcome to the Smartsheet Forum Archives
The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.
Unknown Attribute Error on Update Sheet API request
I am currently using the smartsheet-csharp-sdk class library to interact with the API and I keep getting an exception when I am trying to rename a sheet through Update Sheet.
I do a GetSheet call, change the name to the new sheet name and pass that sheet as the parameter for UpdateSheet. The error I get is "Unknown attribute \"sheetname\" found at..."
The API documentation shows that it is capable of renaming a sheet name, so I'm confused as to why I'm getting this error. I'm not super familiar with writing PUT requests, but I noticed on the API doc that the example PUT request for Update Sheet has the parameter "name" and not "sheetname". Not sure if this has anything to do with it or not.
Thanks,
Nathan
Comments
-
Hi Nathan,
I'm not exactly sure what your code looks like, but you can only change the sheet name if you're the Owner of the sheet. If you're sure that you own the sheet, then make sure that you're using the correct PUT and code.
You need to PUT on /sheets/{sheetid} and then use something like the following in C# (this is somewhat copied out of the documentation):
Sheet sheet = new Sheet.UpdateSheetBuilder(sheetId)
.SetName("New Sheet Name")
.Build();
smartsheet.SheetResources.UpdateSheet(sheet);
If you continue to have problems, contact our Support team and they might be able to review your code. I must confess that my experience lies in JavaScript and not C# but we have people on our Support team with API knowledge, so they can work with you to figure out the error.
-
Found my problem. I was pulling the sheet by SheetResources.GetSheet(sheetId) and then trying to change the Name and then using SheetResources.UpdateSheet(sheet) instead of using the UpdateSheetBuilder. Thanks!
-
Whoops, looks like I made that mistake in my code example above! Fixed.
Glad you found the issue.
EDIT: Apparently I need more coffee. I didn't make a mistake but just misread my example code.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.9K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 458 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 136 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives