Wholesale question

Is it legal to wholesale a home for the owner while he currently have a agent and is being listed in mls? Can I still locked the owner on a wholesale contract?