none
Property access conversion to an activity is not supported for property 'Now' defined on type 'System.DateTime'. RRS feed

  • Question

  • Hello all

    I am developing workflows for SharePoint 2013 using VisualStudio 2017 based on workflow manager 1.0.

    I  faced the following error when I wanted to get current date using "DateTime.Now" and when I wanted to get days of week using "DateTime.DaysOfWeek".

    Severity Code Description Project File Line Suppression State
    Error Failed to translate expression 'dueDate.Now.ToString("dd/MM/yy")' because of the following error:
    Property access conversion to an activity is not supported for property 'Now' defined on type 'System.DateTime'. Online.Workflows C:\Workspace\Online\Online.Workflows\Online.Workflows\CalculateNextWorkDay\CalculateNextWorkDay.xaml 61

    I looked for the solution but the only result about creating/changing AllowedTypes.xml file, and it does not work for me!

    Any help is appreciated

    Best regards

    Tuesday, March 14, 2017 3:49 PM

All replies

  • Hi ,

    Please check the link below

    https://social.technet.microsoft.com/Forums/office/en-US/72def412-6f77-4be1-b2a9-9877b0d87dca/property-access-conversion-to-an-activity-is-not-supported-for-property-today-defined-on-type?forum=sharepointdevelopment


    Please remember to click Mark as Answer on the answer if it helps you

    Tuesday, March 14, 2017 4:07 PM
  • Hi Reza,

    Any update about Sethu's reply?

    Best regards,

    Patrick


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, March 20, 2017 8:51 AM
    Moderator
  • Thank you Sethu, but I have tried it before and it does not work for my case!
    Tuesday, March 21, 2017 9:49 AM
  • Hi Patrick

    Sorry for late reply. Still I am struggling with this issue!

    Regards

    Reza

    Tuesday, March 21, 2017 9:51 AM
  • Hi Reza,

    Do you mean that the workaround “send out a HTTP request in the workflow and extract the current date and time from the response” is not work for your case?

    Currently, I would still recommend you go with this workaround in the workflow.

    Anyway, I will keep an eye on this issue and come back once there is any finding on my side.

    Best regards,

    Patrick

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, March 22, 2017 8:00 AM
    Moderator
  • Hi Patrick

    It is possible to send an http request and get the current time!

    But! I am getting same error while I am using "string.IndexOf()" and some other methods :D

    So, I think there should be an general way to solve this issue!

    I will share my finding here as well.

    Thank you

    Reza


    • Edited by Reza A Wednesday, March 22, 2017 1:13 PM
    Wednesday, March 22, 2017 11:39 AM
  • Hi Again

    The only finding is that it is possible to use "DateTime.UtcNow.AddHours(1)" with out the error to get current time!

    -Reza

    Wednesday, March 29, 2017 12:10 PM