cancel
Showing results for 
Search instead for 
Did you mean: 

Hwo to get a file under the folder with RID?

Former Member
0 Kudos

Hi guys,

how can I get the file name XXX under the folder YYY, which has RID for example

1bczuzrejekwlt? Can I get this file like this way:

1bczuzrejekwlt/XXX

or

I have to change the RID 1bczuzrejekwlt to normal folder name /../YYY, and then concatenate /.../YYY/XXX.

Is there any documents to describe details?

thanks in advance!

Regards,

Liying

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member188556
Active Contributor
0 Kudos

Hi Liying

As far as what i understood from ur doubt is that, u have the RID of the folder YYY.

If u want to get the RID of the resource XXX directly u can use, /documents/YYY/XXX.extension directly.

Like for eg,

<b>RID pathRID =

RID.getRID("/documents/Setup Files/"fileName".txt");

IResource resource = (IResource) resourseFactory.getResource(pathRID,resourseContext);</b>

Now u can use <b>resource.getContent()</b> to get the contents of file.

Award points if found usefull,

BP.

Message was edited by:

BP

Former Member
0 Kudos

Thanks guys!

former_member188556
Active Contributor
0 Kudos

Hi Liying,

U can have the RID of the folder also and can iterate thru all the resources in the folder which will be much more convinient i suppose

If ur req is that way, we can share the code for that...

Regards

BP

Former Member
0 Kudos

Hi BP,

yes, that is also an alternative way, can u share the code?

Thanks

Regards,

Liying

former_member188556
Active Contributor
0 Kudos

Hi Liying,

 RID pathRID = 	RID.getRID("/documents/folderPath");
	ICollection collection =(ICollection) resourseFactory.getResource(
					pathRID,
					resourseContext);
	IResourceList resourceList = collection.getChildren();
	IResourceListIterator resourceListIterator =
	                               resourceList.listIterator();

                while (resourceListIterator.hasNext()) {
		IResource resource =	resourceListIterator.next();
                  //do some action here//
                  //u can check whether the resource is a folder by using 
                  //if(resource.isCollection()); here//
                 }

Award points if found usefull

BP

Former Member
0 Kudos

Thanks BP!

Former Member
0 Kudos

I'm not sure I understand the question.

Is it about the relation of names, as displayed by the UI, and RIDs?

Parts of the UI use the "displayname" property rather than the RID when available. But that doesn't affect access through RIDs at all.

Best regards, Julian