Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

CSOM Duration Custom Fields are strings rather than int or TimeSpan

$
0
0

Custom Fields of Duration types are returning their values in the FieldValues collections as strings rather than numeric values.  This leaves us with values like "2d", "5w", "6d", or "2mo" which are difficult to work with.

The PSI returned them as int's representing tenths of minutes - this is what we need.

- Is there any way to get an int instead of a string?

- Or a method somewhere to convert a duration string to an int?

- Or do we have to code a converter to handle every possible Duration Format to get a usable int?

If so, what are all the possible formats?

Some variation of all these?

https://msdn.microsoft.com/en-us/library/microsoft.office.project.server.library.task.durationformat_di_pj14mref(v=office.15).aspx

If indeed converting these strings is the only way, the base code is trivial provided you assume an 8hr day and 20 day month.  However can't these vary per resource?  That makes things significantly more challenging.

*Note: this is only for Custom Fields.  Elsewhere the CSOM returns TimeSpans which are great.



Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>