Question: I have a custom action that look like this :

```
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="MyCustomAction" Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        ...
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="MyCommand"
          CommandAction="javascript:alert('Hello World!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

```

How can I move the `alert('Hello World!');` JavaScript code from the custom action definition to a dedicated `MyScript.js` file ? (in the `_layout` folder or any other place)

Answer: 
You need SPWeb.SiteGroups ([MSDN link](http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.sitegroups.aspx)) which includes all groups that exist in the site collection.

For further details, please refer to: <http://blog.tylerholmes.com/2007/09/spwebgroups-vs-spwebsitegroups.html>
Have a look at this article.

[Programmatically get SharePoint Users with Group Name](http://sharepoint-works.blogspot.com/2012/05/programmatically-get-sharepoint-users.html)

Hope this helps You!