| Author |
Message |
Jan Rösner
Guest
|
Posted:
Tue Oct 11, 2005 12:51 pm Post subject:
How to automatically rename a document library |
|
|
Hi All,
I've not yet written any .NET- or asp-code but I think this time I won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a website
xyz001. The creation of the website xyz001 is - for instance - based on a
website template, that contains many document libraries. Every document
library must be renamed, so that the new name is "websitename"-"original
document library name". (E.g. the document library "Controlling" of the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website "xyz001" a
url is (manually via button or automatically via ExecuteURL) opened to call
http://blabla....aspx?website="xyz001" and this aspx-page could then contain
code, right?
--> Unfortunately I don't get started at all. Any code snippets? Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint: which
would be the way to solve this problem? --> Installing Visual Studio .NET on
the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan |
|
| Back to top |
|
 |
Gustavo
Guest
|
Posted:
Tue Oct 11, 2005 8:51 pm Post subject:
RE: How to automatically rename a document library |
|
|
Hi Jan,
I think, I would make a WebPart that take care of the entire construction of
the site, with some input from the user (site name, template name, URL, etc),
and, after that the site is ready, she will loop throw all the libraries to
change his names.
The problem is that you don't can catch an event after the creation of the
library, thus, you can't do the name change automatically.
Installing VisualStudio in the SharePoint server is the best and easier
approach to develop software for SPS/WSS.
Suerte,
Gustavo
http://www.gavd.net/servers/default.aspx
"Jan Rösner" wrote:
| Quote: | Hi All,
I've not yet written any .NET- or asp-code but I think this time I won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a website
xyz001. The creation of the website xyz001 is - for instance - based on a
website template, that contains many document libraries. Every document
library must be renamed, so that the new name is "websitename"-"original
document library name". (E.g. the document library "Controlling" of the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website "xyz001" a
url is (manually via button or automatically via ExecuteURL) opened to call
http://blabla....aspx?website="xyz001" and this aspx-page could then contain
code, right?
--> Unfortunately I don't get started at all. Any code snippets? Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint: which
would be the way to solve this problem? --> Installing Visual Studio .NET on
the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan
|
|
|
| Back to top |
|
 |
Dean
Guest
|
Posted:
Thu Oct 13, 2005 12:51 pm Post subject:
Re: How to automatically rename a document library |
|
|
Get the books from Scot Hillier (MS Sharepoint Building Office 2003
Solutions and Advanced Sharepoint Services Solutions) for lots of good
examples and tutorials for doing these types of things with WSS and SPS.
"Jan Rösner" <janroesner@gmx.net> wrote in message
news:uqGlL2lzFHA.3256@TK2MSFTNGP09.phx.gbl...
| Quote: | Hi All,
I've not yet written any .NET- or asp-code but I think this time I won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a website
xyz001. The creation of the website xyz001 is - for instance - based on a
website template, that contains many document libraries. Every document
library must be renamed, so that the new name is "websitename"-"original
document library name". (E.g. the document library "Controlling" of the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website "xyz001" a
url is (manually via button or automatically via ExecuteURL) opened to
call http://blabla....aspx?website="xyz001" and this aspx-page could then
contain code, right?
--> Unfortunately I don't get started at all. Any code snippets? Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint: which
would be the way to solve this problem? --> Installing Visual Studio .NET
on the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan
|
|
|
| Back to top |
|
 |
nitin
Guest
|
Posted:
Fri Oct 14, 2005 4:51 pm Post subject:
RE: How to automatically rename a document library |
|
|
Hi Gustavo,
I also have the same problem. I want to change the HelpLink for each
webparts in the every webpages.For this I get all the webparts on the page
and take the loop for eachwebpart, then try to change the HelpLink property,
but I am not able to do this. Even i can set other properties but not
HelpLink.Do you have any guess??
Or there is any other way?
thanks in advanced.
jainnit
"Gustavo" wrote:
| Quote: | Hi Jan,
I think, I would make a WebPart that take care of the entire construction of
the site, with some input from the user (site name, template name, URL, etc),
and, after that the site is ready, she will loop throw all the libraries to
change his names.
The problem is that you don't can catch an event after the creation of the
library, thus, you can't do the name change automatically.
Installing VisualStudio in the SharePoint server is the best and easier
approach to develop software for SPS/WSS.
Suerte,
Gustavo
http://www.gavd.net/servers/default.aspx
"Jan Rösner" wrote:
Hi All,
I've not yet written any .NET- or asp-code but I think this time I won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a website
xyz001. The creation of the website xyz001 is - for instance - based on a
website template, that contains many document libraries. Every document
library must be renamed, so that the new name is "websitename"-"original
document library name". (E.g. the document library "Controlling" of the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website "xyz001" a
url is (manually via button or automatically via ExecuteURL) opened to call
http://blabla....aspx?website="xyz001" and this aspx-page could then contain
code, right?
--> Unfortunately I don't get started at all. Any code snippets? Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint: which
would be the way to solve this problem? --> Installing Visual Studio .NET on
the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan
|
|
|
| Back to top |
|
 |
nitin
Guest
|
Posted:
Fri Oct 14, 2005 4:51 pm Post subject:
Re: How to automatically rename a document library |
|
|
Hi Jan,
yes Jan, I created a new VS project as the webpart template.Take the exmpl :
I put one button to fatch all webparts in the webpage. On click of this
button i put the following code:
SPWeb mySPWeb =
Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(this.Context);
mySPWeb.AllowUnsafeUpdates = true;
SPWebPartCollection webCollection =
mySPWeb.GetWebPartCollection("default.aspx",Storage.Shared);
foreach (WebPart wptWebPart in webCollection)
{
if(wptWebPart is ListViewWebPart)
{
PropertyInfo[] pinProperties =
wptWebPart.GetType().GetProperties(BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Instance );
int i = 0;
foreach (PropertyInfo pinProperty in pinProperties)
{
//Page.Response.Write("pinProperty Name is: " + pinProperty.Name +
"<br>");
if (pinProperty.Name == "HelpLink")
{
pinProperty.SetValue(wptWebPart, "test", null);
//Page.Response.Write("Value pinProperty.CanWrite " +
pinProperty.CanWrite );
//Page.Response.Write("Value pinProperty.CanRead " +
pinProperty.CanRead );
webCollection.SaveChanges(wptWebPart.StorageKey);
//Page.Response.Write("Value set for: " + wptWebPart.Title + " for
help link is " + wptWebPart.HelpLink + "<br>");
wptWebPart.HelpLink = "test";
webCollection.SaveChanges(wptWebPart.StorageKey);
//Page.Response.Write("Value manually set set for: " +
wptWebPart.Title + " for help link is " + wptWebPart.HelpLink + "<br>");
//Page.Response.Write(wptWebPart.Title + " ShouldSerializeHelpLink :
" + wptWebPart.ShouldSerializeHelpLink());
}
}
}
}
mySPWeb.Update();
Use this code, it would be helpful for you. if there any problem feel free
to ask.
jainnit
"Jan Rösner" wrote:
| Quote: | hi jainnit,
I'm a newbie to webpart-development and even after having read the "Getting
Started"-Stuff on MSDN I actually don't know how to get started ;-(
webparts in the every webpages.For this I get all the webparts on the page
and take the loop for eachwebpart, then try to change the HelpLink
property,
could you explain me in short, how you managed to "get all the webparts on
the page and take a loop for each webpart"?
A) did you create a new "visual basic project"/"ASP.NET Web Application" in
VS.NET which is located on the path C:\.....\web server
extensions\60\TEMPLATE\LAYOUTS\myWebpart ?
B) could you post (or email it to me?) your asp-code for this?
C) how did you then call your application on
http://server/_layouts/myWebpart/...aspx from within your SharePoint
Portal-Site?
I would be really happy if you could give me some directions, coz at the mo
I'm quite stuck in this..
Cheers, jan
"nitin" <nitin@discussions.microsoft.com> schrieb im Newsbeitrag
news:35146C98-8FF1-43B2-A53F-A017C7D979E5@microsoft.com...
Hi Gustavo,
I also have the same problem. I want to change the HelpLink for each
webparts in the every webpages.For this I get all the webparts on the page
and take the loop for eachwebpart, then try to change the HelpLink
property,
but I am not able to do this. Even i can set other properties but not
HelpLink.Do you have any guess??
Or there is any other way?
thanks in advanced.
jainnit
"Gustavo" wrote:
Hi Jan,
I think, I would make a WebPart that take care of the entire construction
of
the site, with some input from the user (site name, template name, URL,
etc),
and, after that the site is ready, she will loop throw all the libraries
to
change his names.
The problem is that you don't can catch an event after the creation of
the
library, thus, you can't do the name change automatically.
Installing VisualStudio in the SharePoint server is the best and easier
approach to develop software for SPS/WSS.
Suerte,
Gustavo
http://www.gavd.net/servers/default.aspx
"Jan Rösner" wrote:
Hi All,
I've not yet written any .NET- or asp-code but I think this time I
won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a website
xyz001. The creation of the website xyz001 is - for instance - based on
a
website template, that contains many document libraries. Every document
library must be renamed, so that the new name is
"websitename"-"original
document library name". (E.g. the document library "Controlling" of the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website "xyz001"
a
url is (manually via button or automatically via ExecuteURL) opened to
call
http://blabla....aspx?website="xyz001" and this aspx-page could then
contain
code, right?
--> Unfortunately I don't get started at all. Any code snippets? Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint:
which
would be the way to solve this problem? --> Installing Visual Studio
.NET on
the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan
|
|
|
| Back to top |
|
 |
Jan Rösner
Guest
|
Posted:
Fri Nov 04, 2005 5:51 pm Post subject:
Re: How to automatically rename a document library |
|
|
hi nitin,
thanks four your code snippet.
It has taken me quite a long time..but now finally I've tried your code in
the following way:
I created a new "Visual C#"-"Web Part Library" in VS.NET 2003.
In the file Webpart1.cs I copied the first twoe lines of your code into the
following sourcecode-part:
protected override void RenderWebPart(HtmlTextWriter output)
{
output.Write("Hello World!" + SPEncode.HtmlEncode(Text));
// now come the first two lines of nitin's code:
SPWeb mySPWeb =
Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(this.Context);
mySPWeb.AllowUnsafeUpdates = true;
}
Afterwards I created a Cab-Project and added the "Project Output" (Content
Files and Primary Output) and after building the solution I installed the
Webpart on my remote server with stsadm -o addwppack -filename
HelloWorldNitin.cab
I can add the webpart on a page but is causes errors (that's what the
web-portal error message says). Without the two lines of your code the
installed webpart successfully displays "Hello World!" - but that's still a
long way from what I want to develop..
Sorry, but I cannot get it started ;-(
1) What did I do wrong?
2) How do you debug a webpart that you develop locally and then install - as
mentioned above - on a remote server?
3) I just want some functionality to rename document libraries in a
website - is a webpart neccessary or could I also develop an aspx-page?
I'm sorry for bothering you guys with those silly newbie-questions but I
hope you can give me some hints how to get it started..
cheers, jan
"nitin" <nitin@discussions.microsoft.com> schrieb im Newsbeitrag
news:<D731D9AD-E060-4250-911A-B5216AB3D109@microsoft.com>...
| Quote: | Hi Jan,
yes Jan, I created a new VS project as the webpart template.Take the exmpl
:
I put one button to fatch all webparts in the webpage. On click of this
button i put the following code:
SPWeb mySPWeb =
Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(this.Context);
mySPWeb.AllowUnsafeUpdates = true;
SPWebPartCollection webCollection =
mySPWeb.GetWebPartCollection("default.aspx",Storage.Shared);
foreach (WebPart wptWebPart in webCollection)
{
if(wptWebPart is ListViewWebPart)
{
PropertyInfo[] pinProperties =
wptWebPart.GetType().GetProperties(BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Instance );
int i = 0;
foreach (PropertyInfo pinProperty in pinProperties)
{
//Page.Response.Write("pinProperty Name is: " + pinProperty.Name +
"<br>");
if (pinProperty.Name == "HelpLink")
{
pinProperty.SetValue(wptWebPart, "test", null);
//Page.Response.Write("Value pinProperty.CanWrite " +
pinProperty.CanWrite );
//Page.Response.Write("Value pinProperty.CanRead " +
pinProperty.CanRead );
webCollection.SaveChanges(wptWebPart.StorageKey);
//Page.Response.Write("Value set for: " + wptWebPart.Title + " for
help link is " + wptWebPart.HelpLink + "<br>");
wptWebPart.HelpLink = "test";
webCollection.SaveChanges(wptWebPart.StorageKey);
//Page.Response.Write("Value manually set set for: " +
wptWebPart.Title + " for help link is " + wptWebPart.HelpLink + "<br>");
//Page.Response.Write(wptWebPart.Title + " ShouldSerializeHelpLink :
" + wptWebPart.ShouldSerializeHelpLink());
}
}
}
}
mySPWeb.Update();
Use this code, it would be helpful for you. if there any problem feel free
to ask.
jainnit
"Jan Rösner" wrote:
hi jainnit,
I'm a newbie to webpart-development and even after having read the
"Getting
Started"-Stuff on MSDN I actually don't know how to get started ;-(
webparts in the every webpages.For this I get all the webparts on the
page
and take the loop for eachwebpart, then try to change the HelpLink
property,
could you explain me in short, how you managed to "get all the webparts
on
the page and take a loop for each webpart"?
A) did you create a new "visual basic project"/"ASP.NET Web Application"
in
VS.NET which is located on the path C:\.....\web server
extensions\60\TEMPLATE\LAYOUTS\myWebpart ?
B) could you post (or email it to me?) your asp-code for this?
C) how did you then call your application on
http://server/_layouts/myWebpart/...aspx from within your SharePoint
Portal-Site?
I would be really happy if you could give me some directions, coz at the
mo
I'm quite stuck in this..
Cheers, jan
"nitin" <nitin@discussions.microsoft.com> schrieb im Newsbeitrag
news:35146C98-8FF1-43B2-A53F-A017C7D979E5@microsoft.com...
Hi Gustavo,
I also have the same problem. I want to change the HelpLink for each
webparts in the every webpages.For this I get all the webparts on the
page
and take the loop for eachwebpart, then try to change the HelpLink
property,
but I am not able to do this. Even i can set other properties but not
HelpLink.Do you have any guess??
Or there is any other way?
thanks in advanced.
jainnit
"Gustavo" wrote:
Hi Jan,
I think, I would make a WebPart that take care of the entire
construction
of
the site, with some input from the user (site name, template name,
URL,
etc),
and, after that the site is ready, she will loop throw all the
libraries
to
change his names.
The problem is that you don't can catch an event after the creation
of
the
library, thus, you can't do the name change automatically.
Installing VisualStudio in the SharePoint server is the best and
easier
approach to develop software for SPS/WSS.
Suerte,
Gustavo
http://www.gavd.net/servers/default.aspx
"Jan Rösner" wrote:
Hi All,
I've not yet written any .NET- or asp-code but I think this time I
won't
find another solution than coding..
I want to "automatically" rename all document libraries of a a
website
xyz001. The creation of the website xyz001 is - for instance -
based on
a
website template, that contains many document libraries. Every
document
library must be renamed, so that the new name is
"websitename"-"original
document library name". (E.g. the document library "Controlling" of
the
website "xyz001" should be renamed to "xyz001-Controlling")
"automatically" could mean, that after creation of the website
"xyz001"
a
url is (manually via button or automatically via ExecuteURL) opened
to
call
http://blabla....aspx?website="xyz001" and this aspx-page could
then
contain
code, right?
--> Unfortunately I don't get started at all. Any code snippets?
Any
recommendable tutorials?
sry, for the silly questions, but I'm a real newbie to SharePoint:
which
would be the way to solve this problem? --> Installing Visual
Studio
.NET on
the SharePoint server??
any(!!) hints are appreciated ;)
cheers, jan
|
|
|
| Back to top |
|
 |
|
|
|
|