Getting "Value Does not fall within Expected Range" Exception
Hello All,
I have Created a Console App in Dot Net Using C# SDK for Smartsheet API.
And Successfully Retrieved the Sheets that are accessed to me using ListSheets() method in my Local system.
But the same method Returns Exception at the Production Server like "Value does not fall within the expected range". in the Line
PaginatedResult<Sheet> sheets = smartsheet.SheetResources.ListSheets(null,null, null);
I used same token for both environment.
Am I missed Something?
Exception:
Unhandled exception. Smartsheet.Api.SmartsheetException: Value does not fall within the expected range.
at Smartsheet.Api.Internal.Http.DefaultHttpClient.Request(HttpRequest smartsheetRequest)
at Smartsheet.Api.Internal.AbstractResources.ListResourcesWithWrapper[T](String path)
at Smartsheet.Api.Internal.SheetResourcesImpl.ListSheets(IEnumerable`1 includes, PaginationParameters paging, Nullable`1 modifiedSince)
at SmartsheetInterface.Program.Main(String[] args) in C:\SmartsheetInterface\Program.cs:line 37
Any help would be greatly appreciated!
Best Answer
-
Hi, It looks like you have the right syntax for C#. I wonder if you can run the List Sheets command just in Curl to isolate it and see if that gives you a response? Then you would know whether it's some other issue or your request through the SDK.
Answers
-
Hi, It looks like you have the right syntax for C#. I wonder if you can run the List Sheets command just in Curl to isolate it and see if that gives you a response? Then you would know whether it's some other issue or your request through the SDK.
-
Hi all, I am having a similar issue and noticed there was no resolution posted. Unlike OP, I cannot get a list of Sheets via C#.
The following CURL command works fine:
curl https://api.smartsheet.com/2.0/sheets -H "Authorization: Bearer {mytoken}" -x "{myproxy}"
However in C# this returns "Value does not fall within expected range":
SmartsheetClient smartsheet = new SmartsheetBuilder()
.SetAccessToken(myToken) //move to config or DB
.SetHttpClient(new ProxyHttpClient(proxy, port))
.Build();PaginatedResult<Sheet> allSheets = smartsheet.SheetResources.ListSheets();
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.6K Get Help
- 423 Global Discussions
- 143 Industry Talk
- 483 Announcements
- 5.1K Ideas & Feature Requests
- 85 Brandfolder
- 152 Just for fun
- 73 Community Job Board
- 492 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 306 Events
- 37 Webinars
- 7.3K Forum Archives