SharePoint 2019 Opening Latest Version of Document

%3CLINGO-SUB%20id%3D%22lingo-sub-1646656%22%20slang%3D%22en-US%22%3ESharePoint%202019%20Opening%20Latest%20Version%20of%20Document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1646656%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20having%20a%20major%20issue%20on%20SharePoint%202019.%20We%20have%20a%20web%20service%20that%20updates%20a%20template%20file%20for%20the%20user.%20The%20next%20user%20receives%20a%20task%20with%20a%20link%20to%20the%20document%20so%20they%20can%20verify%20the%20automated%20changes%20are%20correct.%20However%20when%20the%20user%20clicks%20the%20link%20a%20message%20appears%20at%20the%20top%20stating%20%22%3CSPAN%3EA%20newer%20version%20of%20this%20document%20is%20available%20on%20the%20server.%20Do%20you%20want%20to%20work%20on%20the%20most%20recent%20version%22%20-%20they%20don't%20have%20an%20option%20to%20open%20the%20most%20recent%20version%20only%20to%20discard%20changes%20and%20work%20on%20the%20older%20version.%20None%20of%20the%20automated%20changes%20are%20available%20on%20the%20version%20of%20the%20document%20the%20user%20is%20able%20to%20view.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20the%20user%20goes%20into%20the%20library%20and%20clicks%20the%20document%20the%20same%20issue.%20However%20if%20the%20user%20selects%20download%20and%20opens%20the%20saved%20document%20all%20the%20changes%20are%20available.%20The%20user%20would%20then%20be%20required%20to%20make%20the%20changes%20and%20reupload%20the%20document%20instead%20of%20just%20being%20able%20to%20make%20a%20quick%20change%20and%20save%20the%20document.%20This%20presents%20many%20issues%2C%20first%20being%20that%20most%20of%20our%20end%20users%20do%20not%20have%20direct%20access%20to%20the%20library.%20Second%20it%20prevents%20the%20users%20from%20quickly%20verifying%20their%20changes%20and%20moving%20things%20along%20in%20the%20system.%20It%20also%20means%20users%20receiving%20a%20link%20to%20the%20document%20are%20not%20able%20to%20view%20the%20latest%20version.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHow%20can%20we%20fix%20this%20issue%3F%20When%20the%20automated%20web%20service%20updates%20the%20document%20the%20following%20code%20is%20implemented%3A%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESPFolder%20oLibrary%20%3D%20oWeb.Folders%5BsDocLib%5D%3B%3C%2FP%3E%3CP%3EString%20sFileName%20%3D%20System.IO.Path.GetFileName(sDocPath)%3B%3C%2FP%3E%3CP%3EStream%20streamModifiedDoc%20%3D%20File.OpenRead(sDocPath)%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ebyte%3C%2FSPAN%3E%3CSPAN%3E%5B%5D%20binFile%20%3D%20%3C%2FSPAN%3E%3CSPAN%3Enew%3C%2FSPAN%3E%3CSPAN%3Ebyte%3C%2FSPAN%3E%3CSPAN%3E%5BstreamModifiedDoc.Length%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EstreamModifiedDoc.Read(binFile%2C%200%2C%20binFile.Length)%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EHashtable%20docMetaData%20%3D%20%3C%2FSPAN%3E%3CSPAN%3Enew%3C%2FSPAN%3E%3CSPAN%3EHashtable()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EdocMetaData.Add(%3CSPAN%3E%22RequestID%22%3C%2FSPAN%3E%2C%20sRequestID)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EoWeb.AllowUnsafeUpdates%20%3D%20%3CSPAN%3Etrue%3C%2FSPAN%3E%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ESPFile%20spfile%20%3D%20oLibrary.Files.Add(sFileName%2C%20streamModifiedDoc%2C%20docMetaData%2C%20%3CSPAN%3Etrue%3C%2FSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EoLibrary.Update()%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EoWeb.AllowUnsafeUpdates%20%3D%20%3C%2FSPAN%3E%3CSPAN%3Efalse%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAm%20I%20missing%20something%20that%20will%20allow%20the%20link%20to%20go%20to%20the%20correct%20version%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1646656%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

We are having a major issue on SharePoint 2019. We have a web service that updates a template file for the user. The next user receives a task with a link to the document so they can verify the automated changes are correct. However when the user clicks the link a message appears at the top stating "A newer version of this document is available on the server. Do you want to work on the most recent version" - they don't have an option to open the most recent version only to discard changes and work on the older version. None of the automated changes are available on the version of the document the user is able to view.

 

If the user goes into the library and clicks the document the same issue. However if the user selects download and opens the saved document all the changes are available. The user would then be required to make the changes and reupload the document instead of just being able to make a quick change and save the document. This presents many issues, first being that most of our end users do not have direct access to the library. Second it prevents the users from quickly verifying their changes and moving things along in the system. It also means users receiving a link to the document are not able to view the latest version.

How can we fix this issue? When the automated web service updates the document the following code is implemented:

 

SPFolder oLibrary = oWeb.Folders[sDocLib];

String sFileName = System.IO.Path.GetFileName(sDocPath);

Stream streamModifiedDoc = File.OpenRead(sDocPath);

byte[] binFile = newbyte[streamModifiedDoc.Length];

streamModifiedDoc.Read(binFile, 0, binFile.Length);

Hashtable docMetaData = newHashtable();

docMetaData.Add("RequestID", sRequestID);

oWeb.AllowUnsafeUpdates = true;

SPFile spfile = oLibrary.Files.Add(sFileName, streamModifiedDoc, docMetaData, true);

oLibrary.Update();

oWeb.AllowUnsafeUpdates = false;

Am I missing something that will allow the link to go to the correct version?

 

 

 

0 Replies