Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Document Sharing] Add cancelled parameter and use in word template edit after merge #464

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/System Application/App/Document Sharing/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"idRanges": [
{
"from": 9560,
"to": 9562
"to": 9563
}
],
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ table 9560 "Document Sharing"
DataClassification = SystemMetadata;
InitValue = Ask;
}

/// <summary>
/// Specifies the state of the document sharing operation.
/// </summary>
field(13; State; Enum "Document Sharing State")
{
DataClassification = SystemMetadata;
InitValue = Success;
}
}

keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ codeunit 9561 "Document Sharing Impl."
Handled := false;
Sleep(2000); // This sleep is to ensure the OneDrive clears the lock on the file after the user saves and closes.
DocumentSharingCodeunit.OnGetFileContents(DocumentSharing, Handled);
end;
end else
DocumentSharing.State := DocumentSharing.State::Cancelled;

Handled := false;
DocumentSharingCodeunit.OnDeleteDocument(DocumentSharing, Handled);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.Integration;

/// <summary>
/// The result of the sharing operation.
/// </summary>
enum 9563 "Document Sharing State"
{
Extensible = false;

/// <summary>
/// Operation completed successfully.
/// </summary>
value(0; Success)
{
Caption = 'Success';
}

/// <summary>
/// Operation cancelled.
/// </summary>
value(1; Cancelled)
{
Caption = 'Cancelled';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ codeunit 9988 "Word Template Impl."
TempDocumentSharing.Insert();

DocumentSharing.Share(TempDocumentSharing);

if TempDocumentSharing.State = TempDocumentSharing.State::Cancelled then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to cover also this one scenario in tests
\src\System Application\Test\Word Templates\src*
I would say codeunit 130443 "Word Templates Test" is good fit for it

Error('');

ResultTempBlob.CreateOutStream(OutStream, TextEncoding::UTF8);
TempDocumentSharing.Data.CreateInStream(InStream, TextEncoding::UTF8);
CopyStream(OutStream, InStream);
Expand Down
Loading