Below is a 9.2 python function that I've used on featurelayer joins. Not the perfect solution, like you I wish there was a way to list all join objects on a layer or table. I don't have 10 installed yet, so there may be some changes required to get it to run. I know that 9.3 and 10 will handle the list of fields differently (get rid of the .Next and change While loop to For loop) . Also you will need to import 'traceback' or remove the reference to it in the exception handling.
Hopefully this will give you some ideas in case no one else has a proper solution.
-Steve
## =======================================================================
def RemoveJoins(theInputTable, theWildcard):
## Remove any joined tables matching wildcard string
try:
theJoinList = []
theDesc = gp.Describe(theInputTable)
if theDesc.DataType.upper() == "FEATURELAYER":
theFC = theDesc.Featureclass.Name.replace(".shp","")
#AddMsgAndPrint("\nFeatureclass name for input = " + theFC + "\n", 0)
else:
AddMsgAndPrint("Error." + theInputTable + " is not a featurelayer", 2)
return False
theFields = theDesc.Fields
theField = theFields.Next()
while theField:
FullName = theField.Name
nameList = gp.ParseFieldName(FullName).split(",")
#AddMsgAndPrint(" Qualified field name = " + FullName, 0)
theFieldName = nameList[3]
theTableName = FullName[0:-(len(theFieldName))]
if theTableName != theFC and not theTableName in theJoinList:
# Found join, but only remove it if it matches wildcard
if theWildcard == "" and theTableName != " ":
theJoinList.append(theTableName)
#AddMsgAndPrint(" Removing join: " + theTableName, 0)
gp.RemoveJoin_management(theInput, theTableName)
elif theTableName.startswith(theWildcard):
theJoinList.append(theTableName)
#AddMsgAndPrint(" Removing join: " + theTableName, 0)
gp.RemoveJoin_management(theInput, theTableName)
theField = theFields.Next()
return True
except:
AddMsgAndPrint("Exception in RemoveJoins", 2)
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = tbinfo + "\n" + str(sys.exc_type)+ ": " + str(sys.exc_value)
AddMsgAndPrint(pymsg, 2)
return False