There was a problem opening company.: (inner exception: FileNotFound)

SOLVED

var companyId = GetCompany();

try
{
// Request authorization from Sage 50 for our third-party application.
AuthorizationResult authorizationResult = Session.RequestAccess(companyId);

This line Session.RequestAccess throws a PeachtreeException: FileNotFound

at Sage.Peachtree.API.PeachtreeSession.VerifyOrRequestAccess(CompanyIdentifier companyId, Boolean isAccessRequest, IDictionary`2 authenticationCredentials)
at Sage.Peachtree.API.PeachtreeSession.RequestAccess(CompanyIdentifier companyId)

However the location of the companyId exists and has my Sage company files in it. The GetCompany() method actually pulled the company from the Session.CompanyList()

private CompanyIdentifier GetCompany()
{
var settings = GetSettings();

// Get companies list from session
CompanyIdentifierList companies = null;

if (!String.IsNullOrWhiteSpace(settings.ServerName))
{
companies = Session.CompanyList(settings.ServerName);
}
else
{
companies = Session.CompanyList();
}

// Match on company name
var result = companies.SingleOrDefault(c => c.CompanyName == settings.CompanyName);
if (result != null)
{
return result;
}
else
{
DisplayError($"Company {settings.CompanyName} not found on server {settings.ServerName}", null);
return null;
}
}

Debug output window shows:

Considering Assembly at path:C:\PROGRA~2\Sage\PEACHT~1\Sage.SBD.ACS.Framework.BusinessLogic.dll
Sage.Peachtree.API.Resolver - Assembly FullName values match exactly. Assembly accepted.


Exception thrown: 'Sage.Peachtree.API.Exceptions.UntranslatedException' in Sage.Peachtree.API.dll

Parents
  • 0

    Was a file not found during an assembly load? That's generally what you'd see at this point -- calling RequestAccess() requires a number of the Sage 50 assemblies to load to complete, and there may be one or more that could not be located.

  • 0 in reply to Bill_Coleman

    Trying again:

    This is the exception stack trace:

    "Sage.Peachtree.API.Exceptions.UntranslatedException: FileNotFound --->

    Sage.Peachtree.BusinessLogic.PTKmsMKeyException: FileNotFound\r\n at Sage.Peachtree.Domain.Entities.BaseDomainEntity.SaveInternal()\r\n at Sage.Peachtree.Domain.Entities.BaseDomainEntity.SaveTemplateMethod()\r\n at Sage.Peachtree.Domain.Entities.BaseDomainEntity.Save()\r\n at Sage.Peachtree.Domain.APICompanyContext.VerifyAccess(Boolean requestAccess, IDictionary`2 authenticationCredentials)\r\n at Sage.Peachtree.API.PeachtreeSession.VerifyOrRequestAccess(CompanyIdentifier companyId, Boolean isAccessRequest, IDictionary`2 authenticationCredentials)\r\n --- End of inner exception stack trace ---\r\n at Sage.Peachtree.API.PeachtreeSession.VerifyOrRequestAccess(CompanyIdentifier companyId, Boolean isAccessRequest, IDictionary`2 authenticationCredentials)\r\n at Sage.Peachtree.API.PeachtreeSession.RequestAccess(CompanyIdentifier companyId)\r\n at

  • 0 in reply to Jon H

    KMS system exception. I never seen that before. If your DLLs got crossed up, who knows...

Reply Children
No Data