<%@ page import="com.ibm.workplace.wcm.api.*"%>
<%@ page import="java.util.*"%>
<%
// retrieve repository
Repository repository = WCM_API.getRepository();
// get workspace for current user
Workspace workspace = repository.getWorkspace(request.getUserPrincipal());
// Set library
workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("WebContent"));
DocumentId documentId = null;
Site parentSite = null;
String parentSiteName = "Site";
DocumentId siblingId = null;
// find parent site
DocumentIdIterator siteIterator = workspace.findByName(DocumentTypes.Site,parentSiteName);
if (siteIterator.hasNext()){
documentId = siteIterator.nextId();
parentSite = (Site) workspace.getById(documentId);
// create new sitearea
SiteArea newSiteArea =
workspace.createSiteArea((DocumentId)parentSite.getId(),siblingId,ChildPosition.END);
newSiteArea.setName("NewSiteArea");
newSiteArea.setTitle("NewSiteArea");
newSiteArea.setDescription("New Sitearea Created using WCM API
String[] saveMessage = workspace.save((Document)newSiteArea);
if (saveMessage.length==0) {
out.println ("
Created new Sitearea under " + parentSiteName );
}
} else {
out.println ("
Could not find parent Site " + parentSiteName + ". Could not create a
new Sitearea." );
}
%>
Subscribe to:
Post Comments (Atom)
Generate reports from Opportunities using a Visualforce Page in Salesforce
Step 1: Create a Visualforce Page Go to the Setup menu in Salesforce. Search for "Visualforce Pages" in the Quick Find box and c...
-
So I ran into this nasty little bugger and my approval process came to a grinding halt. For those who have never seen this before your fi...
-
Inline Editing So now I have tested the inline editing jsp done by David De Vos.Simply brilliant! Really offers you the ability to offe...
No comments:
Post a Comment