Skip to content

Commit e88a214

Browse files
committed
Version v0.9.9.4c as is live on LBI
1 parent 2f58021 commit e88a214

File tree

6 files changed

+88
-5
lines changed

6 files changed

+88
-5
lines changed

WorkBoxFramework/Classes/WBExtensions.cs

+8
Original file line numberDiff line numberDiff line change
@@ -2252,13 +2252,21 @@ public static SPFolder WBxGetOrCreateSubFolder(this SPFolder parent, String chil
22522252

22532253
if (found == null)
22542254
{
2255+
// WBLogging.Generic.Unexpected("About to create a child folder with name : " + childName);
2256+
22552257
found = parent.SubFolders.Add(childName);
22562258

2259+
// WBLogging.Generic.Unexpected("Added child folder with name : " + childName);
2260+
22572261
found.Item.SystemUpdate();
22582262
found.Update();
22592263

2264+
// WBLogging.Generic.Unexpected("Done initial update of child folder with name : " + childName);
2265+
22602266
found.Item[SPBuiltInFieldId.ContentTypeId] = contentTypeId;
22612267
found.Item.SystemUpdate();
2268+
2269+
// WBLogging.Generic.Unexpected("Updated content type of child folder with name: " + childName);
22622270
}
22632271

22642272
return found;

WorkBoxFramework/Classes/WBItem.cs

+3
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ public void CopyColumns(WBItem itemToCopy)
343343

344344
public bool MaybeCopyColumns(WBItem itemToCopy, IEnumerable<WBColumn> columnsToCopy)
345345
{
346+
// Let's pick up the item again before copying across the metadata:
347+
this.Reload();
348+
346349
bool allCorrect = false;
347350
foreach (WBColumn column in columnsToCopy)
348351
{

WorkBoxFramework/Classes/WBRecordsLibraries.cs

+36
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,42 @@ public WBRecord DeclareNewRecord(WBTaskFeedback feedback, String callingUserLogi
238238
protectedLibraryRootFolder.WBxGetOrCreateFolderPath(fullClassPath, classFolderType.Id);
239239
SPFolder actualDestinationFolder = protectedLibraryRootFolder.WBxGetOrCreateFolderPath(fullFilingPath, filePartFolderType.Id);
240240

241+
/*
242+
// This next bit is all because we've been having problems when new folders had to be created:
243+
if (actualDestinationFolder == null)
244+
{
245+
WBLogging.RecordsTypes.HighLevel("We have to create part of the folder path: " + fullFilingPath);
246+
actualDestinationFolder = protectedLibraryRootFolder.WBxGetOrCreateFolderPath(fullFilingPath, filePartFolderType.Id);
247+
248+
WBLogging.RecordsTypes.HighLevel("Now we're going to add a dummy first file:");
249+
250+
MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes("Please ignore this file."));
251+
SPFile dummyFile = actualDestinationFolder.Files.Add("FirstFile.txt", memoryStream);
252+
253+
WBLogging.RecordsTypes.HighLevel("Now we're going to try to update the file");
254+
try
255+
{
256+
dummyFile.Item.Update();
257+
}
258+
catch (Exception e)
259+
{
260+
WBLogging.RecordsTypes.Unexpected("And exception did occur while updating the dummy item", e);
261+
}
262+
263+
memoryStream.Dispose();
264+
265+
WBLogging.RecordsTypes.HighLevel("Now re-opening the whole ProtectedMasterLibrary object");
266+
267+
ProtectedMasterLibrary.ReOpen();
268+
269+
WBLogging.RecordsTypes.HighLevel("Have re-opened the whole ProtectedMasterLibrary object - now re-getting the SPFolder:");
270+
271+
protectedLibraryRootFolder = ProtectedMasterLibrary.List.RootFolder;
272+
actualDestinationFolder = protectedLibraryRootFolder.WBxGetFolderPath(fullFilingPath);
273+
}
274+
*/
275+
276+
241277
if (ProtectedMasterLibrary.Web.WBxFileExists(actualDestinationFolder, filename))
242278
{
243279
filename = ProtectedMasterLibrary.Web.WBxMakeFilenameUnique(actualDestinationFolder, filename);

WorkBoxFramework/Classes/WBRecordsLibrary.cs

+20
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,26 @@ public WBRecordsLibrary(WBRecordsLibraries libraries, String url, String protect
152152

153153

154154
#region Methods
155+
156+
public void ReOpen()
157+
{
158+
if (!IsOpen || !_openedByThisObject || _site == null || _web == null || String.IsNullOrEmpty(_url))
159+
{
160+
WBLogging.RecordsTypes.Unexpected("You can't re-open a WBRecordsLibrary if it is not already open - and opened by this object");
161+
throw new Exception("You can't re-open a WBRecordsLibrary if it is not already open");
162+
}
163+
164+
_web.Dispose();
165+
_web = null;
166+
167+
_site.Dispose();
168+
_site = null;
169+
170+
_isOpen = false;
171+
172+
Open();
173+
}
174+
155175
public bool Open()
156176
{
157177
if (IsOpen) return false;

WorkBoxFramework/Classes/WBRecordsManager.cs

+20-4
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,29 @@ public WBPublishingProcess PublishDocument(WBPublishingProcess process)
226226
}
227227
catch (Exception e)
228228
{
229-
feedback.Failed("Something went wrong with the publishing process", e);
230-
WBLogging.Debug("Something went wrong with the publishing process");
229+
feedback.AddFeedback("Something went wrong with first attempt to publish document");
230+
feedback.AddException(e);
231231

232-
process.CurrentItemFailed();
233-
return process;
232+
WBLogging.RecordsTypes.Unexpected("Something went wrong with first attempt to publish document", e);
234233
}
235234

235+
if (newRecord == null)
236+
{
237+
WBLogging.RecordsTypes.Unexpected("Making a second attempt to publish document");
238+
239+
try
240+
{
241+
newRecord = Libraries.DeclareNewRecord(feedback, _callingUserLogin, document, recordToReplace, process.ReplaceAction, process.ExtraMetadata);
242+
}
243+
catch (Exception e)
244+
{
245+
feedback.Failed("Something went wrong with the second attempt to publish document", e);
246+
WBLogging.RecordsTypes.Unexpected("Something went wrong with the second attempt to publish document", e);
247+
248+
process.CurrentItemFailed();
249+
return process;
250+
}
251+
}
236252

237253
WBLogging.Debug("WBRecordsManager.PublishDocument(): Declared new record");
238254
feedback.Success();

WorkBoxFramework/Package/Package.package

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<package xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="122d1e78-156a-4d31-adc1-66fee258b162" solutionId="122d1e78-156a-4d31-adc1-66fee258b162" resetWebServer="false" name="WorkBoxFramework v0.9.9.3c" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/PackageModel">
2+
<package xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="122d1e78-156a-4d31-adc1-66fee258b162" solutionId="122d1e78-156a-4d31-adc1-66fee258b162" resetWebServer="false" name="WorkBoxFramework v0.9.9.4c" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/PackageModel">
33
<assemblies>
44
<customAssembly location="Newtonsoft.Json.dll" deploymentTarget="GlobalAssemblyCache" sourcePath="Include\Newtonsoft.Json.dll" />
55
</assemblies>

0 commit comments

Comments
 (0)