1

I need to do a scheduled or manually trigger update on some hidden properties of files and folders. The items all have different content types with different properties, but the hidden properties are added to the root CT, so that is no problem. Every thing works fine, but some CTs have a required date with validation. Now, when i update the hidden properties, i get a validation error.

The validation checks if the entered date is within the last 30 days. When im updating old files the set date is not valid anymore (since its older than 30 days).

When changing parameters in SharePoint its no problem, because it's only validating the changed fields. But the Update function somehow triggers validation on all properties. Is there a way to update properties without triggering the validation other than removing the validation for the update?

Code:

public static void UpdateMetadataOfFiles(ClientContext siteContext, Dictionary<string, string> metadata, List<string> files)
{
    files.ForEach(file =>
    {
        ListItem item = siteContext.Web.GetListItem(file);
        metadata.ToList().ForEach(meta => item.Properties[meta.Key] = meta.Value);
        item.Update();
    });

    siteContext.ExecuteQueryWithIncrementalRetry();
}

The ExecuteQueryWithIncrementalRetry is a ExecuteQuery wrapper suggested by Microsoft to avoid getting throttled

0

We found the problem. It was on our side. We have a event receiver which does some tasks in the background, including the validation.

We talked to our customer and decided to remove the validation, since it isn't required anymore.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.