要获取所有不在工作流程中的文档,您可以使用Alfresco的REST API来检索文档并过滤掉在工作流程中的文档。下面是一个使用Alfresco REST API的Python示例代码:
import requests
import json
# 设置Alfresco的URL和认证信息
alfresco_url = 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/'
username = 'admin'
password = 'admin'
# 获取Alfresco的认证票据
def get_ticket():
login_url = alfresco_url + 'authentication-ticket'
headers = {'Content-Type': 'application/json'}
data = {
'userId': username,
'password': password
}
response = requests.post(login_url, headers=headers, data=json.dumps(data))
return response.json()['entry']['id']
# 获取所有不在工作流程中的文档
def get_documents_without_workflow():
ticket = get_ticket()
headers = {'Authorization': f'Basic {ticket}'}
documents_url = alfresco_url + 'nodes/-my-/children?where=(EXISTS(%27app:ownableBy%27))&fields=name'
response = requests.get(documents_url, headers=headers)
documents = response.json()['list']['entries']
return [doc['entry']['name'] for doc in documents]
# 打印结果
documents = get_documents_without_workflow()
for doc in documents:
print(doc)
请确保将alfresco_url,username和password替换为您自己的Alfresco实例的URL,用户名和密码。此代码将返回不在工作流程中的所有文档的名称列表。