Slow Performance of xpage while loading a document - xpages

Below is the code which opens the document.
`var strUrl = "$$OpenDominoDocument.xsp?documentId=" + #Word( action, "$", 1) + "&sec=actions&action=openDocument&aid=" + objUserInfo.getuserId();
return strUrl;`

Related

How to implement a interactive excel web addin with browser

I am implementing a excel web addin. I took a template project(excel web addin) using Visual Studio.
Here in code i need to call a URL. that will open in browser popup for login, after login it will have few events like user need to click allow access button. then it will navigate some other URL in same window. now i need to get that URL to my code.
I am able to call the URL and it is opening in browser. but after this i dont any object reference or context to control browser.
Below is the code i written.
SampleNav.js
var w = 800;
var h = 500;
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var dialog = window.open("myurl", "window1", 'width=' + w + ',height=' + h + ',scrollbars=NO, top=' + top + ', left=' + left);
console.log("testDialog: " + window.location.pathname);
console.log("testDialog: " + window.location.hostname);
console.log("testDialog: " + window.location.assign);
console.log("testDialog: " + window.location.href);
console.log("testDialog: " + dialog.location.pathname);
console.log("testDialog: " + dialog.location.hostname);
console.log("testDialog: " + dialog.location.assign);
console.log("testDialog: " + dialog.location.href);
I tried to find something in dialog reference but no use
please suggest needful

Excel VBA xml parsing - Loop through node which has specific attribute

I have an XML file which is of below structure:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<BordereauxItem>
<BordereauxMonth>Sep</BordereauxMonth>
<BordereauxRef>2017-09-27</BordereauxRef>
<EclipseBinderNumber>132</EclipseBinderNumber>
<CertificateNumber>100</CertificateNumber>
</BordereauxItem>
<BordereauxItem>
<BordereauxMonth>aUG</BordereauxMonth>
<BordereauxRef>2017-09-27</BordereauxRef>
<EclipseBinderNumber>142</EclipseBinderNumber>
<CertificateNumber>200</CertificateNumber>
</BordereauxItem>
I just want to loop the node(BordereauxItem) for which the attribute(CertificateNumber = 200).
Currently I am able to loop all the nodes in the XML file, but not able to loop the particular node for which CertificateNumber = 200
As I am spending a couple of days in this without moving ahead, can anyone please help me solve this issue?
Here's simple code to loop throguh nodes and check value of one of child nodes:
Sub LoopNodes()
Dim xml As String, node As String, childNode As String, searchStartIndex As Long, index As Long
searchStartIndex = 0
xml = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""no""?><BordereauxItem><BordereauxMonth>Sep</BordereauxMonth><BordereauxRef>2017-09-27</BordereauxRef><EclipseBinderNumber>132</EclipseBinderNumber><CertificateNumber>100</CertificateNumber></BordereauxItem><BordereauxItem><BordereauxMonth>aUG</BordereauxMonth><BordereauxRef>2017-09-27</BordereauxRef><EclipseBinderNumber>142</EclipseBinderNumber><CertificateNumber>200</CertificateNumber></BordereauxItem>"
node = "BordereauxItem"
childNode = "CertificateNumber"
Do While True
'find BordereauxItem node
searchStartIndex = InStr(searchStartIndex + 1, xml, "<" + node + ">")
If searchStartIndex = 0 Then
MsgBox "No more nodes!"
Exit Do
End If
'find CertificateNumber child node
index = InStr(searchStartIndex, xml, "<" + childNode + ">") + 19
'extract value and check it
If Mid(xml, index, InStr(index, xml, "</" + childNode + ">") - index) = "200" Then
'display node which meets requirements
MsgBox Mid(xml, searchStartIndex, InStr(searchStartIndex + 1, xml, "</" + node + ">") + 17 - searchStartIndex)
End If
Loop
End Sub

Create an iconNote Document in a new database

This is a more explicite extension on my previous question.
From an button on an XPage I create a new database
targetDB = dir.createDatabase(fileName);
I then copy a bunch of stuff into the targetDB from the sourceDB. I then want to set the launch properties in the targetDB which is where the problem comes.
I know that I can get the iconNote = targetDB.getDocumentByID("FFFF0010") except there is no iconDoc in the target. Does anyone have a way to create this doc with the specific NoteID?
I tried copying the iconNote document from the sourceDB to the targetDB but that does not work. Changes the UNID and noteID. Can't find any database method to create an icon Note.
Found lots of stuff on how to change the settings in the iconNote, but nothing on how to create one if there is not one in the database.
Thanks to Jesse I took his code and changed it to SSJS and it works fine.
var dir:NotesDbDirectory = session.getDbDirectory("Development");
var newDB:NotesDatabase = dir.createDatabase("XPages/install/created.nsf");
var importer:NotesDxlImporter = session.createDxlImporter();
importer.setDesignImportOption(6);
var dxl:String = "<?xml version='1.0'?>\n" +
"<note default='true' class='icon'>\n" +
" <item name='$TITLE'>\n" +
" <text>Test Title</text>\n" +
" </item>\n" +
" <item name='$Flags'>\n" +
" <text>J7NZq?!</text>\n" +
" </item>\n" +
"</note>\n";
importer.importDxl(dxl, newDB);
var iconNote = newDB.getDocumentByID("FFFF0010");
iconNote.replaceItemValue("$DefaultXPage", "xpWFSDemo.xsp");
iconNote.replaceItemValue("$DefaultClientXPage", "xpWFSDemo.xsp");
iconNote.save();
dBar.info(iconNote.getItemValueString("$Flags"));
Something like this oughta do it:
DbDirectory dir = session.getDbDirectory(null);
Database newDB = dir.createDatabase("tests/created.nsf");
DxlImporter importer = session.createDxlImporter();
importer.setDesignImportOption(DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);
String dxl = "<?xml version='1.0'?>\n" +
"<note default='true' class='icon'>\n" +
" <item name='$TITLE'>\n" +
" <text>Some DB Title</text>\n" +
" </item>\n" +
" <item name='$Flags'>\n" +
" <text>J7NZq?!</text>\n" +
" </item>\n" +
"</note>\n";
importer.importDxl(dxl, newDB);
That's with the two "open XPage" options set already - you could also include the two XPage name items the same way, and it may be a good idea to export the icon note from an existing DB (database.getDocumentByID("FFFF0010").generateXML()) and paste in the actual icon item as well, since this DXL will result in an icon-less database. Nonetheless, it seems to work in my testing as a basis.
And after that point, you'll be able to fetch the icon note using the usual "FFFF0010" pseudo-ID and replace item values the same way I mentioned before.

Populating share-point look up columns via the web service

I am trying to populate a look-up column in a list, via the web service.
I am getting my data from an asp.net web form and using the web service method UpdateListItems and sending batch XML.
However, unless the user enters the exact data that the look up uses, the web service returns an error.
Is there anyway i can give the user of the web form, similar look-up functionality in order that the data passed will be identical?
i'm using share point 2007
The data source for the look-up column in share point is active directory.
_x0028_HR_x0029__x0020_Partner is the look up column, entering the users login name will look up their full name/ you can pick from a list.
Your help is much appreciated.
ClasService.Lists NewStarterList = new ClasService.Lists();
NewStarterList.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["SPUserName"].ToString(),
ConfigurationManager.AppSettings["SPPassword"].ToString(), ConfigurationManager.AppSettings["SPDomain"].ToString());
NewStarterList.Url = ConfigurationManager.AppSettings["SPUrl"].ToString() + ConfigurationManager.AppSettings["SPServicePath"].ToString();
try
{
string strBatch = "<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + clasStarter.ClasID + "</Field>" +
"<Field Name='Title'>" + clasStarter.Name + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Job_x0020'>" + clasStarter.JobTitle + "</Field>" +
"<Field Name='Entity'>" + clasStarter.Entity + "</Field>" +
"<Field Name='Practice_x0020_Groups'>" + clasStarter.PracticeGroup + "</Field>" +
"<Field Name='Dept'>" + clasStarter.Department + "</Field>" +
"<Field Name='Physical_x0020_Desk_x0020_Locati'>" + clasStarter.Location + ", " + clasStarter.LocationInBuilding + ", " + clasStarter.Department + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Line_x002'>" + clasStarter.LineManager + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Buddy'>" + clasStarter.Buddy + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Partner'>" + clasStarter.Partner + "</Field>" +//is a look up
"</Method>";
XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
elBatch.SetAttribute("OnError", "Continue");
elBatch.SetAttribute("ListVersion", "1");
elBatch.SetAttribute("ViewName", ConfigurationManager.AppSettings["SPViewID"].ToString());
elBatch.InnerXml = strBatch;
XmlNode ndReturn = NewStarterList.UpdateListItems(ConfigurationManager.AppSettings["SPListID"].ToString(), elBatch);
}
catch (Exception exp)
{
throw new Exception("NewStarterForm - Clas Update failed ", exp);
}
I haven't figured out a full solution my problem, but i have figured out part of it.
Share point look-up columns have two parts, an id and a value. If you don't know the value then you can just use -1;# as a substitute for the ID
an example of this is
"<Field Name='Partner'>-1;#" + partnerLogOnId + "</Field>"
I will probably use a list, that allows users of my form to select people, and will pass the partnerLogOnId to my web service method.

SharePoint : Translating links for me, and its unwanted

I am inserting a list item using sharepoint web services....
Here is my code:
item += #"<Field Name=""HyperLinkField"">" + this.SharePointSiteAddressLinks + #"/lists/" + this.ListName + #"/" + this.ID + "_" + this.MessageID + ", " + this.MessageID + ".ext</Field>";
the value of SharePointSiteAddressLinks is http://machineName
The list item gets inserted into the list, but the value of the hyperlink is set to http://localhost
Firstly - why does SharePoint take it apon itself to (incorrect) my links, 2ndly what can I do to turn it off?
Thank you
Restarted the server, everything worked fine....

Resources