//########################################################
function GetSearchFolder(SFId ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'search-folders/' + SFId,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
debugger;
//temp = $.grep(resp.data, function (d) {
// return d.name == WSName;
//});
//cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function GetWorkspace(WSName ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/search',// ?name=' + WSName,//until we get the indexer to work
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
temp = $.grep(resp.data, function (d) {
return d.name == WSName;
});
cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function CreateSearchFolder(folderName, TaxYear ){
var stripped = cache[ "ws_id"].replace(/\D/g,'');
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/' + cache[ "ws_id" ] + '/search-folders',
type: 'post',
data: JSON.stringify({
database: "Blah",
name: folderName,
default_security: "inherit",
searchprofile:
{
"custom4":TaxYear,
"container": stripped,
"databases":"Blah"
}
}),
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
//cache[ "folder_id" ] = resp.data.id;
console.log("CreateSearchFolder:success");
},
failure: function( resp ){
console.log("CreateSearchFolder:failure");
console.log(resp);
}
})
);
}
//########################################################
// implementation
//########################################################
getToken().then(GetWorkspace("Blah"))
.then(CreateSearchFolder("31-Dec-2017", "2017"))
Showing posts with label IManage. Show all posts
Showing posts with label IManage. Show all posts
Wednesday, May 24, 2017
Create Search Folder In Imanage
Tuesday, May 23, 2017
wcf JSON deserialization
this
new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(results)
will not work with complex objects
you need to create objects
for example, this is the IManage Login JSON
new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(results)
will not work with complex objects
you need to create objects
for example, this is the IManage Login JSON
[DataContract]
public class IManageUser
{
[DataMember(Name = "email")]
public string email { get; set; }
[DataMember(Name = "full_name")]
public string full_name { get; set; }
[DataMember(Name = "user_id")]
public string user_id { get; set; }
}
[DataContract]
public class IManageLoginInfo
{
[DataMember(Name = "X-Auth-Token")]
public string X_Auth_Token { get; set; }
[DataMember(Name = "max_age")]
public int max_age { get; set; }
[DataMember(Name = "persona")]
public string persona { get; set; }
[DataMember(Name = "user")]
public IManageUser user { get; set; }
}
then you could do something like this:
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
results = sr.ReadToEnd();
sr.Close();
IManageLoginInfo info = null;
using (MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(results)))
{
DataContractJsonSerializer
serializer = new DataContractJsonSerializer(typeof(IManageLoginInfo));
info = (IManageLoginInfo)serializer.ReadObject(ms);
}
this.token =
info.X_Auth_Token;
Friday, May 19, 2017
Create search folder in IManage API
//########################################################
function GetSearchFolder(SFId ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'search-folders/' + SFId,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
debugger;
//temp = $.grep(resp.data, function (d) {
// return d.name == WSName;
//});
//cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function GetWorkspace(WSName ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/search',// ?name=' + WSName,//until we get the indexer to work
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
temp = $.grep(resp.data, function (d) {
return d.name == WSName;
});
cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function CreateSearchFolder(folderName, TaxYear ){
var stripped = cache[ "ws_id"].replace(/\D/g,'');
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/' + cache[ "ws_id" ] + '/search-folders',
type: 'post',
data: JSON.stringify({
database: "Blah",
name: folderName,
default_security: "inherit",
searchprofile:
{
"custom4":TaxYear,
"container": stripped,
"databases":"Blah"
}
}),
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
//cache[ "folder_id" ] = resp.data.id;
console.log("CreateSearchFolder:success");
},
failure: function( resp ){
console.log("CreateSearchFolder:failure");
console.log(resp);
}
})
);
}
//########################################################
// implementation
//########################################################
getToken().then(GetWorkspace("Blah"))
.then(CreateSearchFolder("31-Dec-2017", "2017b"))
"databases" property is wierd
function GetSearchFolder(SFId ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'search-folders/' + SFId,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
debugger;
//temp = $.grep(resp.data, function (d) {
// return d.name == WSName;
//});
//cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function GetWorkspace(WSName ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/search',// ?name=' + WSName,//until we get the indexer to work
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
temp = $.grep(resp.data, function (d) {
return d.name == WSName;
});
cache[ "ws_id" ] = temp[0].id ;
console.log("GetWorkspace:success");
},
failure: function( resp ){
console.log("GetWorkspace:failure");
console.log(resp);
}
})
);
}
//########################################################
function CreateSearchFolder(folderName, TaxYear ){
var stripped = cache[ "ws_id"].replace(/\D/g,'');
// return either the cached value or jqXHR object wrapped Promise
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'workspaces/' + cache[ "ws_id" ] + '/search-folders',
type: 'post',
data: JSON.stringify({
database: "Blah",
name: folderName,
default_security: "inherit",
searchprofile:
{
"custom4":TaxYear,
"container": stripped,
"databases":"Blah"
}
}),
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
//cache[ "folder_id" ] = resp.data.id;
console.log("CreateSearchFolder:success");
},
failure: function( resp ){
console.log("CreateSearchFolder:failure");
console.log(resp);
}
})
);
}
//########################################################
// implementation
//########################################################
getToken().then(GetWorkspace("Blah"))
.then(CreateSearchFolder("31-Dec-2017", "2017b"))
"databases" property is wierd
IManage code to add workspace to my matters
/////////////////////////////////////////////////////////////////////////////////////////////
function getWS(wsName ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
$.ajax({
url: cache["baseurl"] +'workspaces/search', //goto get the indexer to work - ?name=' +wsName,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
debugger;
var temp = resp.data.filter(function(item) {
return item.name == wsName;
});
cache[ "ws_name" ] =wsName;
cache[ "ws_id" ] = temp[0].id;
console.log("getWS:success");
},
failure: function( resp ){
console.log("getWS:failure");
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
/*
access levels
"no_access", "read", "read_write", "full_access"
what are the possible values for user types?
"user" or "group"
*/
function addWSToMyMatters(){
return $.when(
$.ajax({
url: cache["baseurl"] + 'folders/my-matters/subfolders',
type: 'post',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
data: JSON.stringify({ "name":cache[ "ws_name" ],
"target":
{ "database":"Blah",
"id":cache[ "ws_id" ],
"subtype":"work",
"wstype":"workspace"}
}),
success: function( resp ){
debugger;
//user_type
// cache[ "doc_id" ] = resp.data[0].id;
console.log("addWSToMyMatters:success");
},
failure: function( resp ){
console.log("addWSToMyMatters:failure");
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
getToken().then(getWS("11Blah)"))
.then(addWSToMyMatters());
function getWS(wsName ){
// return either the cached value or jqXHR object wrapped Promise
return $.when(
$.ajax({
url: cache["baseurl"] +'workspaces/search', //goto get the indexer to work - ?name=' +wsName,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
debugger;
var temp = resp.data.filter(function(item) {
return item.name == wsName;
});
cache[ "ws_name" ] =wsName;
cache[ "ws_id" ] = temp[0].id;
console.log("getWS:success");
},
failure: function( resp ){
console.log("getWS:failure");
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
/*
access levels
"no_access", "read", "read_write", "full_access"
what are the possible values for user types?
"user" or "group"
*/
function addWSToMyMatters(){
return $.when(
$.ajax({
url: cache["baseurl"] + 'folders/my-matters/subfolders',
type: 'post',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
data: JSON.stringify({ "name":cache[ "ws_name" ],
"target":
{ "database":"Blah",
"id":cache[ "ws_id" ],
"subtype":"work",
"wstype":"workspace"}
}),
success: function( resp ){
debugger;
//user_type
// cache[ "doc_id" ] = resp.data[0].id;
console.log("addWSToMyMatters:success");
},
failure: function( resp ){
console.log("addWSToMyMatters:failure");
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
getToken().then(getWS("11Blah)"))
.then(addWSToMyMatters());
IManage search by metadata in API
since IManage has this horrible bug that search by metadata doesn't work here is a horrible kluge
///////////////////////////////////////////////////////////////
function getProfile(docid){
return $.when(
$.ajax({
url: cache["baseurl"] +'documents/' + docid ,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
currentProfile = resp;
console.log("getProfile:success " + docid);
},
failure: function( resp ){
console.log("getProfile:failure " + docid);
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
function SearchDoc(params ){
// return either the cached value or jqXHR object wrapped Promise
var temp;
return $.when(
$.ajax({
url: cache["baseurl"] +'documents/search',
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
temp = resp.data.filter(function(item) {
getProfile(item.id)
//debugger;
if(currentProfile !== null){
for(var key in params) {
//debugger;
if(currentProfile.data[key] === undefined || currentProfile.data[key] != params[key])
return false;
}
return true;
}
else{
return false;
}
});
debugger;
//return temp;
// cache[ "doc_id" ] = resp.data[0].id;
console.log("getDoc:success");
},
failure: function( resp ){
console.log("getDoc:failure");
console.log(resp);
}
})
);
}
///////////////////////////////////////////////////////////////
p ={custom4:"2015"};
getToken().then(SearchDoc(p))
///////////////////////////////////////////////////////////////
function getProfile(docid){
return $.when(
$.ajax({
url: cache["baseurl"] +'documents/' + docid ,
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
//debugger;
currentProfile = resp;
console.log("getProfile:success " + docid);
},
failure: function( resp ){
console.log("getProfile:failure " + docid);
console.log(resp);
}
})
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
function SearchDoc(params ){
// return either the cached value or jqXHR object wrapped Promise
var temp;
return $.when(
$.ajax({
url: cache["baseurl"] +'documents/search',
type: 'get',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
success: function( resp ){
temp = resp.data.filter(function(item) {
getProfile(item.id)
//debugger;
if(currentProfile !== null){
for(var key in params) {
//debugger;
if(currentProfile.data[key] === undefined || currentProfile.data[key] != params[key])
return false;
}
return true;
}
else{
return false;
}
});
debugger;
//return temp;
// cache[ "doc_id" ] = resp.data[0].id;
console.log("getDoc:success");
},
failure: function( resp ){
console.log("getDoc:failure");
console.log(resp);
}
})
);
}
///////////////////////////////////////////////////////////////
p ={custom4:"2015"};
getToken().then(SearchDoc(p))
Monday, May 15, 2017
Adding Imanage metadata - JS Example
function AddMetadata(customField, customValue , customDescription, parentValue){
// return either the cached value or jqXHR object wrapped Promise
var payload ={};
if(parentValue===null){
payload = { database: "Blah",
id: customValue,
description: customDescription,
wstype: customField,
enabled: true,
hipaa: false
};
}
else{
payload = { database: "Blah",
id: customValue,
description: customDescription,
wstype: customField,
enabled: true,
hipaa: false,
parent: {
id: parentValue
},
};
}
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'customs/'+ customField,
type: 'post',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
data: JSON.stringify(payload),
success: function( resp ){
//debugger;
//cache[ "doc_id" ] = resp.data[0].id ;
console.log("AddMetadata:success");
},
failure: function( resp ){
console.log("AddMetadata:failure");
console.log(resp);
}
})
);
}
///////////////////////////////////////////////////////////////
// return either the cached value or jqXHR object wrapped Promise
var payload ={};
if(parentValue===null){
payload = { database: "Blah",
id: customValue,
description: customDescription,
wstype: customField,
enabled: true,
hipaa: false
};
}
else{
payload = { database: "Blah",
id: customValue,
description: customDescription,
wstype: customField,
enabled: true,
hipaa: false,
parent: {
id: parentValue
},
};
}
return $.when(
// cache[ "Token" ] ||
$.ajax({
url: cache["baseurl"] +'customs/'+ customField,
type: 'post',
headers: {
'X-Auth-Token':cache[ "Token" ],
'Content-Type': 'application/json'
},
dataType: 'json',
data: JSON.stringify(payload),
success: function( resp ){
//debugger;
//cache[ "doc_id" ] = resp.data[0].id ;
console.log("AddMetadata:success");
},
failure: function( resp ){
console.log("AddMetadata:failure");
console.log(resp);
}
})
);
}
///////////////////////////////////////////////////////////////
IManage groups
NOS values
- 6 - Active Directory
- 2 - Virtual
An external user or a user in an external group will only have access to workspaces that have explicit access. So public workspaces will not be visible for external users.
Friday, May 12, 2017
IManage work installation issues
we have a firewall that only allows calls to 443 and 80 ports
so you cant communicate to the IManage server unless ports 1080, 1081 are opened
so you cant communicate to the IManage server unless ports 1080, 1081 are opened
Imanage uploading a file the second time
There is something that is very
annoying with iManage concerning uploading documents
If you upload a document to a
folder twice you will get 2 different documents , not a choice for overwriting
or a new version
This is true if you drag and
drop or use file upload
To get a new version you need to
either
Or edit the doc and save as new
version in imanage word plugin
This, BTW, is the default
behavior in desk site, but you can change that in the registry
In desk site there is a
different problem in that when you upload a doc you have to fill the author
(it’s not set from the user who’s logged in) and it doesn’t figure out
the class
In this instance the web is
better
Subscribe to:
Comments (Atom)



Options
Set the following DWORD value:
Name: Default SaveAs Option
Values:
1 – The New Document option is selected by default.
2 – The Replace Original option is selected by default.
3 – The New Version option is selected by default.