I might have to come up with an Uber migration and deployment tool J

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sezai KOMUR
Sent: Friday, 30 November 2007 12:21 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: Moving pages programmatically within a web -> sub web 
whilst maintaining versioning

>> I find it hard to believe that they would not allow developers to write code 
>> for automating the publishing process

There is no Microsoft.SharePoint.Publishing.PublishingPage.Move(destination) 
method.  
(http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingpage_members.aspx
 ) there should be and it should do exactly what the manage content and 
structure tool's MOVE operation does, because moving a publishing page seems 
like a core/standard publishing task that should be provided in an API.

Although, there seems to be a 
Microsoft.SharePoint.SPListItem.CopyTo(destination) method 
(http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.copyto.aspx),
 and it might work for a publishing page, here's a blog post where someone uses 
it for moving publishing pages, 
http://sharepointbergen.blogspot.com/2007/06/splistitem-and-copyto-method.html 
not sure if this works well (haven't tried this myself) or if there are any 
metadata issues or problems with lost version history using SPListItem.CopyTo()

Sezai Kömür
Senior Developer  - BEng, BSc - Microsoft Certified Technology Specialist  -  
http://www.moss2007.com.au/

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Lynch
Sent: Thursday, 29 November 2007 4:03 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: Moving pages programmatically within a web -> sub web 
whilst maintaining versioning

WOOT! It's WSS friendly...

WSS Site + custom master pages + custom web parts + custom CSS = Happiness and 
Joy.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sezai KOMUR
Sent: Thursday, 29 November 2007 5:52 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: Moving pages programmatically within a web -> sub web 
whilst maintaining versioning

You may be right Matt, the internal classes seem to eventually end up using 
SPExport so even though there are many layers of internal classes, if you 
follow the trail through to the end of the implementation using reflector you 
may be able to work out how to do it.

I found this which may help :

Move a wiki page with code
http://www.dotnet-friends.com/Forum/ThreadMessages.aspx?Viewed=0&ForumID=29&TopicID=105&ThreadNew=0

The guy developed a simple GUI with two textboxes, enter the source and 
destination and then click a button to run SPExport
Sezai Kömür
Senior Developer  - BEng, BSc - Microsoft Certified Technology Specialist  -  
http://www.moss2007.com.au/

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Lynch
Sent: Thursday, 29 November 2007 3:42 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: Moving pages programmatically within a web -> sub web 
whilst maintaining versioning

Are you sure there is no Façade for accessing the internal classes?  Normally 
when MS or another company release private/internal classes, they also expose a 
API which allows you to work with the classes indirectly.

2c: I'm more of a WSS fan and I have my own publishing engine, so I'm can't be 
counted as a authority on this, but MS normally follow convention (be it good 
or bad).  Sharepoint is a flagship product and I find it hard to believe that 
they would not allow developers to write code for automating the publishing 
process.

Cheers,

Matt

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sezai KOMUR
Sent: Thursday, 29 November 2007 5:21 PM
To: [email protected]
Subject: [OzMOSS] RE: Moving pages programmatically within a web -> sub web 
whilst maintaining versioning

The Manage Content and Structure tool in Publishing Sites has a move command, 
and it seems to move an Page across to a new SPWeb and preserves version 
history of the page and meta data.

Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems is an internal 
class that is used by the manage content and structure tool to move pages 
between spwebs

Loading this class into reflector, it seems that the code first copies across 
the item to the destination first, then checks if the copy was successful, it 
then deletes the source item.

How is the copy done?
DeploymentWrapper wrapper = new DeploymentWrapper(base.Site);
wrapper.PrimeExportProgressUpdated += new 
DeploymentWrapper.ExportProgressUpdatedCallBackHandler(this.deploymentWrapper_PrimeExportProgressUpdated);
      wrapper.PrimeCallBack += new 
DeploymentWrapper.ImportCallBackEventHandler(this.deploymentWrapper_PrimeCallBack);
      wrapper.PrimeImportError += new 
DeploymentWrapper.ImportErrorCallBackHandler(this.deploymentWrapper_PrimeImportError);
      objectSerializer = ObjectSerializer.GetObjectSerializer(base.Site, 
this.destinationid);
      string str = Convert.ToString(this.sourceSmtObjectIds.Length, 
CultureInfo.InvariantCulture);
      base.StatusDescription = 
Resources.GetFormattedString("SmtMoveWrapperStart", new object[] { str });
      base.UpdateStatus();
      wrapper.MoveItems(this.sourceSmtObjectIds, this.destSmtObjectId);
      this.isMoveItemsOutOfSomeVariationHierarchy = 
wrapper.IsMoveItemsOutOfSomeVariationHierarchy;

SPExportSettings exportSettings = new SPExportSettings();
        this.configureExportCopyOrMove(sourceSmtObjectIds, ref exportSettings, 
SPIncludeVersions.All);
        export = new SPExport(exportSettings);
        export.ProgressUpdated += new 
EventHandler<SPDeploymentEventArgs>(this.export_ProgressUpdated);
        export.Run();
        SPImportSettings importSettings = new SPImportSettings();
        this.copyDestSmtObject = 
ObjectSerializer.GetObjectSerializer(this.site, destSmtObjectId);
        this.configureImportCopyOrMove(exportSettings, ref importSettings);
        SPImport import = new SPImport(importSettings);
        this.copyOrMoveRequiresVariationsCleanup = 
this.CheckIsMoveItemsOutOfSomeVariationHierarchy(sourceSmtObjectIds, 
destSmtObjectId);
        import.ObjectImported += new 
EventHandler<SPObjectImportedEventArgs>(this.import_ObjectImported);
        import.Started += new 
EventHandler<SPDeploymentEventArgs>(this.importStarted_CopyOrMove);
        import.Error += new 
EventHandler<SPDeploymentErrorEventArgs>(this.import_Error);
        import.Run();

The code uses more Internal Classes L, looks like the PRIME API (Content 
Deployment) is used to do the copy, which explains how the Versioning and 
History is preserved with the move, just like content deployment between 
servers in a Farm.

On top of that it seems the code also fixes inbound links to the original page, 
so links to the old page location throughout the MOSS site are updated, and now 
point to the new page location.

Would be so much nicer if this wasn't an internal class, we could then use this 
class in our code.  What compounds this further is the Internal Class further 
uses MORE Internal Classes... So I don't see a way we could reproduce this same 
functionality with our own custom code, thanks for tying our hands like this 
Microsoft!

>> find a proper way to programmatically do a supposing simple task like moving 
>> a page (list item).

Microsoft did develop a way to do this, but they don't want anyone else to 
re-use their internal class. Seems silly to me because as Wilson mentions this 
is a simple task we would all expect would be easy and standard to develop.

Sezai Kömür
Senior Developer  - BEng, BSc - Microsoft Certified Technology Specialist  -  
http://www.moss2007.com.au/

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WAMPERS Wilson 
(Con)
Sent: Thursday, 29 November 2007 2:10 PM
To: [email protected]
Subject: [OzMOSS] Moving pages programmatically within a web -> sub web whilst 
maintaining versioning

Hi All,

I wonder if someone can give me some recommendations on which method to 'best' 
use moving a (publishing) page from a web to a sub-web programmatically, in a 
way that the page's versioning can be kept? (all on the same farm, even using 
the same master page, content type ...)
I've tried:

·         Using SPFile.moveto to move it to a document folder and then use 
redirection pages to point to it .. gives metadata issues. (Don't like 
workaround solutions in the first place)

·         Using SPExport, SPImport (Microsoft.SharePoint.Deployment) and 
different settings of it, but still 'metadata missing' issues remain either 
when the moved page is opened or when looking at it going 'edit toolbar' Page 
-> Page Settings and Schedule.

I managed to get custom timer jobs going (thx Andrew Connell) etc... But I find 
it very difficult to find a proper way to programmatically do a supposing 
simple task like moving a page (list item).
If somebody can point me in the right direction that'll be very much 
appreciated, thank you.

Kind Regards,

Wilson Wampers









------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net



------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com - List managed by www.readify.net

Reply via email to