cancel
Showing results for 
Search instead for 
Did you mean: 

How to find Node-IDs

samudaya
Champ on-the-rise
Champ on-the-rise
Hi friends,

I want to find "Node ID" of User Home and Other Folders by using the "ifresco-phplib" PHP library or any other mechanism.


Thanks
Samudaya
3 REPLIES 3

dallinns
Champ on-the-rise
Champ on-the-rise
I don't know the best way to do this, but I've been doing it like this:
$query = "PATH:\"/app:company_home/cm:user_homes/.\"";
$usersFolderQueryResult = $session->query($spacesStore, $query);
$usersFolder = $usersFolderQueryResult[0];
$id = $usersFolder->id

samudaya
Champ on-the-rise
Champ on-the-rise
Hi,

There is no result when I used it. My code is;

<?php
           session_start();
   $repositoryUrl = "http://dms.abc.com:8080/api";
   $userName = "admin";
   $password = "adminpassword";

   require_once "Alfresco/Service/Repository.php";
   require_once "Alfresco/Service/Session.php";
   require_once "Alfresco/Service/SpacesStore.php";
   require_once "Alfresco/Service/UserDetail.php";
   require_once "Alfresco/Service/Administration.php";
   require_once "Alfresco/Service/NamedValues.php";
   
   // Authenticate the user and create a session
   $repository       = new Repository($repositoryUrl);
   $ticket          = $repository->authenticate($userName, $password);
   $session          = $repository->createSession($ticket);
   $spacesStore       = new SpacesStore($session);
   
   $query = "PATH:\"/app:company_home/cm:user_homes/.\"";
   $usersFolderQueryResult = $session->query($spacesStore, $query);
   $usersFolder = $usersFolderQueryResult[0];
   $id = $usersFolder->id;
   echo $id;
?>

So how to correct my above code and how to identify Node-ID for "Other Folders" ?

Thanks
Samudaya

ddanninger
Champ in-the-making
Champ in-the-making
on your previous function it is better to access the method not the property:


$id = $usersFolder->getId();

instead of


$id = $usersFolder->id;