Hi Rob,
You can access this through SDK by using standard Retrieving, that is in the Organization Entity.
There is no dedicated Class Message for this Rob
Overall, you just need to query Organization Entity and also Fiscal Year setting is stored in the FiscalCalendarStart field or "fiscalcalendarstart" if you use Early Bound.
Here is the code you can use
//Using LINQ
private void RetrieveOrganizationFiscalYear()
{
_service = new XrmContext();
XrmContext xrmContext = new XrmContext();
var OrganizationSettings = from os in xrmContext.OrganizationSet
select new Organization
{
FiscalCalendarStart = os.FiscalCalendarStart,
};
DateTime dtStartFiscalYear = OrganizationSettings.First().FiscalCalendarStart.Value;
}
//Using Late Bound
private void RetrieveOrganizationFiscalYearLateBound(IOrganizationService _service)
{
//Retrieve organization
Entity enOrganization = new Entity("organization");
EntityCollection ecOrganizations = new EntityCollection();
DateTime dtStartFiscal = new DateTime();
QueryExpression qx = new QueryExpression();
qx.EntityName = "organization";
qx.ColumnSet.AllColumns = true;
ecOrganizations = _service.RetrieveMultiple(qx);
if (ecOrganizations.Entities.Count > 0)
{
enOrganization = ecOrganizations.Entities[0];
dtStartFiscal = enOrganization.GetAttributeValue<DateTime>("fiscalcalendarstart");
}
}
I hope this can help you!
Thanks.