We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Unable to create document from template

When I try to create a document from a template by using DocumentAgent CreateNewPhysicalDocumentFromTemplate then I get a System.Data.SqlClient.SqlException. I am using the current NuGet packages (SuperOffice.NetServer.Core, SuperOffice.NetServer.Services, v8.0.6352.42) but the same error also occurs in SuperOffice 7.5.

SuperOffice.CRM.Services.DocumentAgent documentAgent = new SuperOffice.CRM.Services.DocumentAgent();
// create a document entity
SuperOffice.CRM.Services.DocumentEntity documentEntity = documentAgent.CreateDefaultDocumentEntity();
// set properties of document entity
documentEntity.Attention = "AB 2091";
documentEntity.Header = "Test document";
documentEntity.Name = "Test.docx";
documentEntity.OurRef = "Our Reference";
documentEntity.YourRef = "Your Reference";
documentEntity.Description = "This is a new document entity created using DocumentAgent";
documentEntity.Date = DateTime.Today;
documentEntity.ExternalRef = "External Reference";
// set the document template for the document
SuperOffice.CRM.Services.DocumentTemplate docTmpl = new SuperOffice.CRM.Services.DocumentTemplate();
docTmpl.DocumentTemplateId = 1;
documentEntity.DocumentTemplate = docTmpl;
// set the owner of the document
SuperOffice.CRM.Services.Associate owner = new SuperOffice.CRM.Services.Associate();
owner.AssociateId = 8;
documentEntity.Associate = owner;
// set the person to whom the document is connected : optional
SuperOffice.CRM.Services.Person person = new SuperOffice.CRM.Services.Person();
person.PersonId = 121;
documentEntity.Person = person;
// set the contact associated with the document: can also be null
SuperOffice.CRM.Services.Contact contact = new SuperOffice.CRM.Services.Contact();
contact.ContactId = 4;
documentEntity.Contact = contact;
// set the project to which the document is connected  : optional
SuperOffice.CRM.Services.Project project = new SuperOffice.CRM.Services.Project();
project.ProjectId = 5;
documentEntity.Project = project;
// create document in database, works fine
documentEntity = documentAgent.SaveDocumentEntity(documentEntity);
string uiCulture = "de-DE";
// create a new physical document and store it in the document archive
documentAgent.CreateNewPhysicalDocumentFromTemplate(documentEntity.Contact.ContactId, documentEntity.Person.PersonId, 0, documentEntity.DocumentId, 0, 0, documentEntity.Project.ProjectId, uiCulture);
// ERROR SuperOffice.Exceptions.SoException: Service call failed with exception; Document.CreateNewPhysicalDocumentFromTemplate ---> System.Exception: Error occurred at creating the physical document ---> System.Data.SqlClient.SqlException: Fehler auf Übertragungsebene beim Senden der Anforderung an den Server. (provider: Shared Memory Provider, error: 0 - Entweder wurde eine geforderte Identitätswechselebene nicht geliefert, oder die gelieferte Identitätswechselebene ist unzulässig.) ---> System.ComponentModel.Win32Exception: Entweder wurde eine geforderte Identitätswechselebene nicht geliefert, oder die gelieferte Identitätswechselebene ist unzulässig

CreateNewPhysicalDocumentFromTemplate raises the following exception:

SuperOffice.Exceptions.SoException: Service call failed with exception
Document.CreateNewPhysicalDocumentFromTemplate ---> System.Exception: Error occurred at creating the physical document ---> System.Data.SqlClient.SqlException: Fehler auf Übertragungsebene beim Senden der Anforderung an den Server. (provider: Shared Memory Provider, error: 0 - Entweder wurde eine geforderte Identitätswechselebene nicht geliefert, oder die gelieferte Identitätswechselebene ist unzulässig.) ---> System.ComponentModel.Win32Exception: Entweder wurde eine geforderte Identitätswechselebene nicht geliefert, oder die gelieferte Identitätswechselebene ist unzulässig
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   bei System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   bei System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   bei System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
   bei System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
   bei System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
   bei System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
   bei System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   bei System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   bei System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect)
   bei System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName)
   bei System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
   bei System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction(IsolationLevel isolationLevel)
   bei SuperOffice.Data.SoConnection.BeginTransaction(IsolationLevel isolationLevel) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\Data\SoConnection.cs:Zeile 244.
   bei SuperOffice.CRM.Rows.TableRowBase.RowLoad(ITableRowLoadHandler handler) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Rows\TableRowBase.cs:Zeile 256.
   bei SuperOffice.CRM.Rows.AppointmentRow.AppointmentRowIdxBase.ToAppointmentRow(ITableRowLoadHandler handler) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Rows\gen\Appointment.cs:Zeile 10982.
   bei SuperOffice.CRM.Entities.Appointment..ctor(AppointmentIdxBase idx) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Entities\gen\Appointment.cs:Zeile 1899.
   bei SuperOffice.CRM.Entities.Document.CreateRelatedDocumentAppointment() in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Entities\Document.cs:Zeile 171.
   bei SuperOffice.CRM.Entities.Document.get_DocumentAppointment() in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Entities\gen\Document.cs:Zeile 1306.
   bei SuperOffice.CRM.Entities.Providers.DocumentInfoProvider.get_AssociateLoginName() in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Entities\Providers\DocumentInfoProvider.cs:Zeile 108.
   bei SuperOffice.CRM.Documents.SoArc2Helper.GetCurrentVersionFolderPath(IDocumentInfo documentInfo) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Documents\SoArc2Helper.cs:Zeile 316.
   bei SuperOffice.CRM.Documents.SoArc2Helper.GetFullArchivePath(IDocumentInfo documentInfo) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Documents\SoArc2Helper.cs:Zeile 68.
   bei SuperOffice.CRM.Documents.SoArc2.CreateDocument(IDocumentInfo incomingInfo, String& fileName, String[] extraFields, String versionDecription, String[] versionExtraFields) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Documents\SoArc2.cs:Zeile 828.
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei SuperOffice.CRM.Documents.SoArc2.CreateDocument(IDocumentInfo incomingInfo, String& fileName, String[] extraFields, String versionDecription, String[] versionExtraFields) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Documents\SoArc2.cs:Zeile 845.
   bei SuperOffice.CRM.Documents.PhysicalDocument.CreateNewFromTemplateWithTags(IDocumentInfo incomingInfo, String& fileName, String[] extraFields, String versionDecription, String[] versionExtraFields, TagContainer templateTags, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SoDataBase\CRM\Documents\PhysicalDocument.cs:Zeile 190.
   bei SuperOffice.CRM.Services.Implementation.BL.DocumentEntityImplementation.CreateNewPhysicalDocument(Int32 documentId, Boolean allowExisting, StringDictionary extraFields, TemplateVariables tv, Boolean createMergeDraft, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SuperOffice.Services.Implementation\BL\DocumentEntityImplementation.cs:Zeile 160.
   bei SuperOffice.CRM.Services.Implementation.BL.DocumentEntityImplementation.CreateNewPhysicalDocumentFromTemplateWithCustomTags(Int32 contactId, Int32 personId, Int32 appointmentId, Int32 documentId, Int32 saleId, Int32 selectionId, Int32 projectId, String[] customTags, String[] customValues, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SuperOffice.Services.Implementation\BL\DocumentEntityImplementation.cs:Zeile 633.
   bei SuperOffice.CRM.Services.Implementation.DocumentAgentLocal.CreateNewPhysicalDocumentFromTemplate(Int32 contactId, Int32 personId, Int32 appointmentId, Int32 documentId, Int32 saleId, Int32 selectionId, Int32 projectId, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SuperOffice.Services.Implementation\DocumentAgentLocal.cs:Zeile 1032.
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei SuperOffice.CRM.Services.Implementation.DocumentAgentLocal.CreateNewPhysicalDocumentFromTemplate(Int32 contactId, Int32 personId, Int32 appointmentId, Int32 documentId, Int32 saleId, Int32 selectionId, Int32 projectId, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SuperOffice.Services.Implementation\DocumentAgentLocal.cs:Zeile 1046.
   bei SuperOffice.CRM.Services.DocumentAgent.CreateNewPhysicalDocumentFromTemplate(Int32 contactId, Int32 personId, Int32 appointmentId, Int32 documentId, Int32 saleId, Int32 selectionId, Int32 projectId, String uiCulture) in c:\Builds\N1\Seven\Rel80_C\Sources\Server\Source\SuperOffice.Services\IDocumentAgent.cs:Zeile 997.
   bei NetServerTest.Program.TestDocument() in D:\SuperOffice\dev\NetServerTest\NetServerTest\Program.cs:Zeile 96.
   bei NetServerTest.Util.LogError(String message) in D:\SuperOffice\dev\NetServerTest\NetServerTest\Util.cs:Zeile 305.
   bei NetServerTest.Program.TestDocument() in D:\SuperOffice\dev\NetServerTest\NetServerTest\Program.cs:Zeile 127.
   bei NetServerTest.Program.Main(String[] args) in D:\SuperOffice\dev\NetServerTest\NetServerTest\Program.cs:Zeile 18.

Any ideas?

Marc

Ingen svar så langt