Skip to content

Commit

Permalink
Add-PnPDataRowsToSiteTemplate export dates as UTC string (#1900)
Browse files Browse the repository at this point in the history
* Updated example of the query parameter

* Updated example of the query parameter

* Exports date as UTC string so they are correctly imported again

Co-authored-by: Bart-Jan <bartjan@i4-you.com>
  • Loading branch information
bjdekker and Bart-Jan committed May 26, 2022
1 parent 95aed55 commit 0f3cc5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Commands/Provisioning/Site/AddDataRowsToSiteTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ private string GetFieldValueAsText(Web web, ListItem listItem, Microsoft.SharePo
return string.Join(";#", multipleChoiceValue);
}
return Convert.ToString(rawValue);
case FieldType.DateTime:
var dateValue = rawValue as DateTime?;
if(dateValue != null)
{
return string.Format("{0:O}", dateValue.Value.ToUniversalTime());
}
throw new Exception("Invalid data in field");
default:
return Convert.ToString(rawValue);
}
Expand Down

0 comments on commit 0f3cc5d

Please sign in to comment.