[2ff88f42] Implementierung E-Mail-Dokument-Automatisierung und technischer Check der Versand-Blocker. Workaround via SuperOffice-Aktivitäten etabliert.

Implementierung E-Mail-Dokument-Automatisierung und technischer Check der Versand-Blocker. Workaround via SuperOffice-Aktivitäten etabliert.
This commit is contained in:
2026-02-28 14:25:25 +00:00
parent 176e1f89f4
commit 4eccb55eab
10 changed files with 309 additions and 55 deletions

View File

@@ -1,62 +1,50 @@
import json
import os
import sys
from dotenv import load_dotenv
load_dotenv(override=True)
from superoffice_client import SuperOfficeClient
import logging
# Setup Logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("discovery")
# Force unbuffered stdout
sys.stdout.reconfigure(line_buffering=True)
def discover():
print("🔍 Starting SuperOffice Discovery Tool...")
print("🔍 Starting SuperOffice Discovery Tool (Direct Sending)...")
client = SuperOfficeClient()
try:
client = SuperOfficeClient()
except Exception as e:
print(f"❌ Failed to init client: {e}")
return
if not client.access_token:
print("❌ Auth failed. Check .env")
return
# 1. Discover UDFs (User Defined Fields)
print("\n--- 1. User Defined Fields (UDFs) Definitions ---")
# 4. Check Sending Endpoints
print("\n--- 4. Direct Sending Endpoints ---")
# EMail Agent
print(f"Checking Endpoint: Agents/EMail/GetDefaultEMailFromAddress...")
try:
# Fetch Metadata about UDFs to get Labels
udf_info = client._get("UserDefinedFieldInfo")
if udf_info:
print(f"Found {len(udf_info)} UDF definitions.")
# Filter for Contact and Person UDFs
contact_udfs = [u for u in udf_info if u['UDTargetEntityName'] == 'Contact']
person_udfs = [u for u in udf_info if u['UDTargetEntityName'] == 'Person']
print(f"\n--- CONTACT UDFs ({len(contact_udfs)}) ---")
for u in contact_udfs:
print(f" - Label: '{u['FieldLabel']}' | ProgId: '{u['ProgId']}' | Type: {u['UDFieldType']}")
print(f"\n--- PERSON UDFs ({len(person_udfs)}) ---")
for u in person_udfs:
print(f" - Label: '{u['FieldLabel']}' | ProgId: '{u['ProgId']}' | Type: {u['UDFieldType']}")
res = client._get("Agents/EMail/GetDefaultEMailFromAddress")
if res:
print(f"✅ Agents/EMail active. Default From: {json.dumps(res)}")
else:
print("❌ Could not fetch UserDefinedFieldInfo.")
print(f"❓ Agents/EMail returned None (likely 404/403).")
except Exception as e:
print(f"Error fetching UDF Info: {e}")
print(f"Agents/EMail check failed: {e}")
print("\n--- 2. Sample Data Inspection ---")
lists_to_check = ["position", "business"]
for list_name in lists_to_check:
print(f"\nChecking List: '{list_name}'...")
try:
# Endpoint: GET /List/{list_name}/Items
items = client._get(f"List/{list_name}/Items")
if items:
print(f"Found {len(items)} items in '{list_name}':")
for item in items:
print(f" - ID: {item['Id']} | Name: '{item['Name']}'")
else:
print(f" (List '{list_name}' is empty or not accessible)")
except Exception as e:
print(f" ❌ Failed to fetch list '{list_name}': {e}")
# TicketMessage
print(f"Checking Endpoint: Archive/dynamic (Ticket)...")
try:
res = client._get("Archive/dynamic?$select=all&$top=1&entity=ticket")
if res:
print(f"✅ Ticket entities found. Service module active.")
else:
print(f"❓ No Ticket entities found (Service module inactive?).")
except Exception as e:
print(f"❌ Ticket check failed: {e}")
if __name__ == "__main__":
discover()