I'm using some what smiler to following code for update an object in Find Service
client.Update(Id).Field(x => x.PublishDate, newTime).Execute();
But when particulate object is not in the index, I'm getting following error:
[WebException: The remote server returned an error: (404) Not Found.]
But what I want is, if particular item is not available in the index, query should execute without an exception (even though it will not effecting any object in the index). So how could I achieve this ?
You can put your code insida a try-catch-statement:
client.Update<BlogPost>(Id).Field(x => x.PublishDate, newTime).Execute();
catch (Exception ex)
Johan, other than try-catch, is there any systematic EPiServer Find way (in query level) of doing this ?
I don't think so. It's common practice to return 404 status codes in RESTful APIs when objects are not found.