Saturday, 27 June 2009
Host EXE files in MOSS
1) Create a folder in the shared location on the web server (should be repeated on all Front end servers)
2) Provide the web-sharing for that folder and add an alias name for that by selecting the Relevant Sharepoint Web Application in the web-sharing properties tab
3) Add every one to that folder from security tab with "READ" access only
4) Open IIS and browse this newly created folder properties and ensure that "Anonymous access" is enabled.
5) Add the link as follows in any content enabled pages
Download your executable from here: "<a href = "[servername]/[websharedfoldername]/[exename]">"EXEName" </a>
Cheers!! we are done
Happy SPD'ing
Saturday, 9 May 2009
Content Editor WebPart to Upload Multiple Documents to SharePoint Library
Then as an immediate resolution I have added an content Editor Web Part and added this piece of code chunks into that.
In this we are using the existing Upload file which can be found at 12 hive\Layouts.
<SCRIPT LANGUAGE="javascript">
function FilesUpload()
{
document.getElementById('idUploadCtl').MultipleUpload();
alert('File Uploading Completed');
}
</SCRIPT>
<INPUT TYPE="hidden" NAME="Cmd" VALUE="Save">
<INPUT TYPE="hidden" NAME="NextUsing" VALUE="http://[Server]/[Document Library]/Forms/AllItems.aspx">
<INPUT TYPE="hidden" VALUE="New">
<INPUT TYPE="hidden" NAME="putopts" VALUE="true">
<INPUT TYPE="hidden" NAME="destination" VALUE="http://[Server]/[Document Library]">
<INPUT TYPE="hidden" NAME="Confirmation-URL" VALUE="http://[Server]/[Document Library]/Forms/AllItems.aspx">
<INPUT TYPE="hidden" NAME="PostURL" VALUE="http://[Server]/_vti_bin/shtml.dll/_layouts/UpLoad.aspx" />
<INPUT TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<DIV ID='MukiDidAgain' >
<P CLASS="ms-toolbar">
<A HREF="javascript:FilesUpload()"
TARGET="_self">Save Files</A>
</P>
<OBJECT id=idUploadCtl name=idUploadCtl CLASSID=CLSID:07B06095-5687-4d13-9E32-12B4259C9813 WIDTH='100%' HEIGHT='350px'></OBJECT>
</DIV>
! Replace [Server] with your server URL and [Document Library] with the desired document library
Cheers! we are done
Happy SPD'ing.
Wednesday, 11 February 2009
MOSS Developer handy dandy tips
1)Access STSADM from any directory while in command prompt.
2) Recyle the Application Pool with command prompt.
******************************************************************************
3) Grab the Public Key Token while in Visual Studio Environment.
Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
Arguments: -Tp "$(TargetPath)"
Check Output window option.
Now when we have a signed project, and after building that project, just click on the Tools-->Grab Public Key value button, then we can see that value in the output window.
******************************************************************************
4)Display all the Search Results before applying our custom XSLT/Styling
a) Open the Search Results Page in Edit Mode.
b) Click on "Modify Shared WebPart" link on "Search Core Results" web part.
c) Click on XSL Editor button and in the Opened Editor window paste the following code.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform > <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/">
<xmp>
<xsl:copy-of select="*"/>
</xmp>
</xsl:template>
</xsl:stylesheet>
d) Click OK and then refresh the page with search key word again then we can see the full results without any styling or customizations.
******************************************************************************
5)Search for specific command in STSADM list at command prompt
stsadm -help createsite. This shows the command with parameters.
But if we want to rename the site then it would be tough for us trying to remember the correct operation Name.
Simply type in STSADM FIND "SITE" (with quotes, STSADM and Find are seperated using pipe symbol ) at the command prompt. It lists out all the commands which has word "site" in them.
******************************************************************************
6) Export the (My)sites list to end user with less effort.
Just type in STSADM -o enumsites -url http://moss:xxxxx >>c:\MySitesList.xml
And you are done. When the Operation is completed, then simply open C:\MySitesList.xml file for the details.
******************************************************************************
7)Display Time at your Command prompt
While executing the one of the STSADM commands, I found it took long time, but how much. We cant always look at the system time or your watch before executing command. I felt there should be some way in command window itself to show the command execution time.******************************************************************************
8) To Open Central Admin from command prompt
******************************************************************************
9) To perform mass publishing for documents/Images
******************************************************************************
10) Saving output of STSADM command
To save the output of STSADM Command into a text file use the following :
eg:stsadm -o addsolution -filename MySoln.wsp >>output.txt 2>&1
(Dont remove 2>&1--these are standard dos error handlers.)
If we are using -immediate or -time or -local (Asynchronous commands) with STSADM command, then next STSADM command would fail. Like:
stsadm -o retractsolution -name Mysolution.wsp -immediate
stsadm -o deletesolution -name Mysolution.wsp
The second command should execute after the first command has executed completely. But here it would fail.In order to avoid that we have two solutions
Solution One:
Solution Two:
******************************************************************************
11) Opening the Multiple Upload Window
Sometimes, I have seen in the client environment, "MultipleUpload" link is not shown in document libraries,which we will discuss later, but as a simple trick to enable that, try to do following
1. Open the document Library for which they cannot see "MultipleUpload"
2. Click on "UploadDocument" and the window opens with URL /_layouts/Upload.aspx?=[ListID and some blah blah]
3. Now add the "&MultipleUpload=1" at the end of the URL and press enter.
It would open the MultipleUpload screen, still if you are unable to see "MultipleUpload", then refer the "Content Editor Web Part tricks" in Interesting Links.
******************************************************************************
Happy SPD'ing
Tuesday, 27 January 2009
Steps to Create a Alert WebControl and deploy to MOSS
Steps involved in creating a webcontrol:
1) Create a button control,intialize it on the Page load, Assign the click event to that
And attach code for that event handler.
Code goes like this.
namespace AlertMeWC
{
[ToolboxData("<{0}:ManageAlerts runat=server>")]
public class ManageAlerts : WebControl
{
private System.String btnCreateAlert;
private LinkButton btnCreate;
public System.String btnCreateAlertID
{
get
{
return btnCreateAlert;
}
set
{
btnCreateAlert = value;
}
}
private void CreateAlert(object sender, EventArgs e)
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate(){
SPSite _site = SPContext.Current.Site;
SPWeb _web = _site.OpenWeb();
SPAlert newalert = _web.Alerts.Add();
newalert.AlertType = SPAlertType.Item;
newalert.AlertFrequency = SPAlertFrequency.Immediate;
newalert.DynamicRecipient = Get the Logged in user details.
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/pages"))
{
newalert.Item = _web.GetListItem(HttpContext.Current.Request.Url.ToString()); newalert.Title = "Pages: FirstPage.aspx";
newalert.Update();
_web.AllowUnsafeUpdates = true;
_web.Update();
_web.AllowUnsafeUpdates = false;
}
});
}
catch (Exception ex)
{
Page.Response.Write("Error in ManageAlerts " + ex.Message.ToString());
}
finally
{
//Dispose web
}
}
private void InitializeControls()
{
btnCreate = InitializeControls
}
private T InitializeControls
{
object _BaseControl = null;
T _Return = default(T);
if (String.IsNullOrEmpty(strControlID))
{
throw new ApplicationException("ManageAlerts Initialization failed: The " + strPropertyName + " attribute must specify a valid " + typeof(T).ToString() + ". The attribute was not specified.");
}
_BaseControl = this.NamingContainer.FindControl(strControlID);
if (_BaseControl == null)
{
throw new ApplicationException("ManageAlerts Initialization failed: The " + strPropertyName + " attribute must specify a valid " + typeof(T).ToString() + ". The control " + strControlID + " cannot be found.");
}
if (!(_BaseControl is T))
{
throw new ApplicationException("ManageAlerts Initialization failed: The " + strPropertyName + " attribute must specify a valid " + typeof(T).ToString() + ". The control " + strControlID + " is a " + _BaseControl.GetType().ToString() + ", and is not supported.");
}
_Return =(T)_BaseControl;
Return _Return;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
InitializeControls();
btnCreate.Click += new EventHandler(this.CreateAlert);
}
catch (Exception ex)
{
Page.Response.Write("Error: " + ex.Message.ToString());
}
finally
{
}
}
}
}
2)Assign the strong name, GAC and grab public key token.
3)Navigate to your site where we would like to stick this webcontrol on.
4)Create a new page and edit that page in Sharepoint designer.
Add the following lines to that Page in SPD.
<@ Register Tagprefix="muki" Namespace="AlertMeWC" Assembly="AlertmeWC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=#$@$%@$%@#%@5" %>
Add this in body tag.
<muki:ManageAlerts ID="ManageAlerts" runat="server" btnCreateReportID ="btnCreate"/>
When ever the user clicks on this link, then automatically alerts are created
Enjoy SPD'ing!!