I want collect and create a block containing headlines which only has "ID" property in the headlines.
i.e The headlines to be filtered looks like
* Headline
:PROPERTIES:
:ID: my-id
:END:
I am using the following code to configure the custom agenda command which does not work
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID")))))
I have read the org manual http://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties but still unable to figure out how to do it.
Your code as such is asking it to find all headlines that have a :ID:
tag on the headline. To look for properties you have to use the property match feature which is listed a bit lower on the linked manual page.
Since I'm assuming you need it to match any ID and not just a specific ID you'll have to use the regexp matching by either matching (=
) or not matching (<>
) the regexp that follows in curly brackets.
To match your ID property you'll need the regexp to be ID={.+}
. If you used .*
as the match it would also match headlines without any ID property. If you have some a set of IDs you want to match that have something in common you can adjust the regexp to match them.
So your custom agenda command will have to be:
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID={.+}")))))